I'm afraid there is no direct example.
The instant messenger demo could be suitable for a used-based data filter,
but we opted for requesting different item names directly from the clients, to keep it simple.
You could achieve the behavior you describe through small changes on the MonitorDemo Metadata Adapter in
DOCS-SDKs\sdk_adapter_java\examples\Monitor_MetadataAdapter.
Suppose that you want that the "msgs" item yields ERROR messages for some users and INFO messages for other users (DEBUG messages are not available in this example), you should extend getItems to become like:
public String[] getItems(String user, String session, String id) throws ItemsException {
String[] broken = super.getItems(user, session, id);
for (int i=0; i < broken.length; i++) {
if (broken[i].equalsIgnoreCase("msgs")) {
if (myTest(user)) {
broken[i] = "monitor_log_error";
} else {
broken[i] = "monitor_log_info";
}
}
broken[i] = convertMonitorName(broken[i],session);
}
return broken;
}
Then you can change the front-end in
pages\demos\MonitorDemo to request the "msgs" item in place, for instance, of "monitor_log_warning".
The user name has now to be supplied to Lightstreamer by the front-end at Engine creation. Hence, you can add something like:
lsEngine.connection.setUserName("myName");
lsEngine.connection.setPassword("myPassword");
in onEngineCreation.
The default configuration of the demos does not perform credential checks, so all user names can be used. Of course, you should also extend the Metadata Adapter with a suitable implementation of
notifyUser.
Note that the
DOCS-SDKs\sdk_adapter_java\examples\Monitor_MetadataAdapter Adapter is not the predeployed one. You can achieve the same by working on the predeployed but more complicated one in
DOCS-SDKs\sdk_adapter_java\examples\Mixed_MetadataAdapter.
Final note: I haven't tested the code.