XmlBlaster Logo

REQUIREMENT

engine.LoginLogoutEvent

XmlBlaster Logo


Type NEW
Priority LOW
Status DEPRECATED
Topic Clients can be notified about other clients login or logout events. Deprecated: Please use events as described in requirement admin.events
Des
cription
There are two internal messages which hold login and logout events. You can subscribe to "__sys__Login" to be notified when a new client logs in, and to "__sys__Logout" to be notified when a client logs out. The message content contains the login name of this client.

The public Session Id is passed in the client properties with the key "__publicSessionId", it is of type long. Further the absolute, cluster wide unique name is available with the key "__absoluteName", it is of type String.

Example
Java

Work around to receive events with new EventPlugin

To reveive the login/logout event with the new framework please add this to xmlBlasterPlugins.xml:

   <plugin create='true' id='connectEvent' className='org.xmlBlaster.engine.EventPlugin'>
      <action do='LOAD' onStartupRunlevel='8' sequence='4'/>
      <action do='STOP' onShutdownRunlevel='7' sequence='4'/>
      <attribute id='eventTypes'>client/*/session/*/event/connect</attribute>
      <attribute id='destination.publish'>
         "publish.key=<key oid='__sys__Login'><__sys__internal/></key>",
         "publish.qos=<qos><expiration lifeTime='0'/><topic destroyDelay='30000'>
                              <persistence relating='msgUnitStore' type='RAM'/>
                              <queue relating='history' type='RAM'/></topic></qos>"
      </attribute>
   </plugin>

   <plugin create='true' id='disconnectEvent' className='org.xmlBlaster.engine.EventPlugin'>
      <action do='LOAD' onStartupRunlevel='8' sequence='4'/>
      <action do='STOP' onShutdownRunlevel='7' sequence='4'/>
      <attribute id='eventTypes'>client/*/session/*/event/disconnect</attribute>
      <attribute id='destination.publish'>
         "publish.key=<key oid='__sys__Logout'><__sys__internal/></key>",
         "publish.qos=<qos><expiration lifeTime='0'/><topic destroyDelay='30000'>
                              <persistence relating='msgUnitStore' type='RAM'/>
                              <queue relating='history' type='RAM'/></topic></qos>"
      </attribute>
   </plugin>

   <plugin create='true' id='clientListEvent' className='org.xmlBlaster.engine.EventPlugin'>
      <action do='LOAD' onStartupRunlevel='8' sequence='4'/>
      <action do='STOP' onShutdownRunlevel='7' sequence='4'/>
      <attribute id='eventTypes'>client/*/session/*/event/connect,client/*/session/*/event/disconnect</attribute>
      <attribute id='destination.publish'>
         "publish.key=<key oid='__sys__UserList'><__sys__internal/></key>",
         "publish.content=$_{clientList}",
         "publish.qos=<qos><expiration lifeTime='0'/>
                      <topic destroyDelay='30000'><persistence relating='msgUnitStore' type='RAM'/>
                      <queue relating='history' type='RAM'/></topic></qos>"
      </attribute>
   </plugin>

The returned client properties contain all need informations:

content:
  client/*/session/*/event/connect
content (example for __sys__UserList):
  __RequestBroker_internal[heron],Martin,SimpleReaderGui,Joe
  ...
qos:
  ...
  <clientProperty name='_eventType'>client/*/session/*/event/connect</clientProperty>
  <clientProperty name='_subjectId'>Martin</clientProperty>
  <clientProperty name='_publicSessionId' type='long'>1</clientProperty>
  <clientProperty name='_summary'>Login of client /node/xmlBlaster_127_0_0_2_3412/client/Martin/1</clientProperty>
  <clientProperty name='_absoluteName'>/node/heron/client/Martin/1</clientProperty>
  ...

Note that we have marked the event message to be volatile, this is a little change of behavior to the original events, further the login name is not delivered in the content anymore, you'll find it in the client property 'subjectId'.

See http://www.xmlblaster.org/xmlBlaster/doc/requirements/admin.events.html

You can as well query the __sys__UserList information as follows:

java javaclients.HelloWorldGet -oid __cmd:?clientList
Example
Java

The following Java code snippet shows the access to the client login events:

// subscribe on login events:
String xmlKey = "<key oid='__sys__Login' queryType='EXACT'></key>";
String qos = "<qos></qos>";
try {
   xmlBlaster.subscribe(xmlKey, qos);
} catch(XmlBlasterException e) {
}

...

// in the update() method you receive a message on client login:
// Example for a client session "/node/heron/client/joe/2":

// Access "joe"
String loginName = new String(content);

// Access "2"
long publicSessionId = updateQos.getClientProperty("__publicSessionId", 0L);
System.out.println("Client " + loginName + " logged in with session " + publicSessionId);

// Access "/node/heron/client/joe/2"
String absoluteName = updateQos.getClientProperty("__absoluteName", "");
System.out.println("Client is '" + absoluteName + "'");
Configure

These parameters allow to configure the plugin.

Email data sink specific settings

Property Default / Example Description Impl
loginEvent true Send an event on client login using topic name __sys__Login. yes
logoutEvent true Send an event on client logout using topic name __sys__Logout. yes
userListEvent true Send complete user list when a client comes or goes using topic name __sys__UserList. yes

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See REQ admin
See REQ admin.events
See TEST org.xmlBlaster.test.authentication.TestLoginLogoutEvent

This page is generated from the requirement XML file xmlBlaster/doc/requirements/engine.LoginLogoutEvent.xml

Back to overview