How the event manager handles remote events

For BTT server event manager, all the events are regarded as remote events which are including server event, external server event, and client event. When a BTT Handler registers the server event manager as a handler of a specific event the following occurs:
  1. A BTT Handler sends a handle event request in message queue to the server event manager.
  2. In the handle event request , it specified notifier name, event name, and BTT Handler global ID. When a BTT Handler is created, system automatically generates a BTT Handler global ID to identify BTT Handler.
  3. When the server event manager gets the request, it creates a corresponding Mirror Handler, which represents the requesting BTT Handler, and saves this Mirror Handler in the handler list of Mirror Notifier. When a BTT Notifier is created, the server event manager creates a corresponding Mirror Notifier in its notifier list that represents that BTT Notifier.
  4. When a BTT Notifier signals an event, the server event manager will get all the Mirror Handlers in corresponding Mirror Notifier list and each of these Mirror Handler will invoke "dispatchEvent()" method to send event in message queue to corresponding BTT Handler.

For a BTT client, application registers the client event manager as a handler of a specific remote event, the following occurs:

  1. A BTT client application invokes the registerInterestInRemoteEvent method in the client event manager instance and passes the following information as arguments:
    • The event name
    • The notifier name
    • The context in which the operation registering the interest is running
    • If there is more than one session from the client to different servers, the name of the Client/Server Mechanism (C/S Messaging API) instance that is managing the session.
  2. The client event manager instantiates an EventManagerClientOperation to manage the communication between event managers on the client and server workstations. The client event manager then invokes the send method of the appropriate BTT Invoker Mechanism instance to start the remote EventManagerServerInvoker.
  3. On the server side, the Client/Server mechanism instantiates and runs the EventManagerServerOperation.
  4. The EventManagerServerOperation execute method calls the addHandler method of the server workstation's event manager and passes the event name, the notifier name, and the terminal identifier (TID) of originating workstation as arguments.
  5. The server event manager invokes BTT Session Management to map this TID to the corresponding session ID. Then the server event manager uses session ID, notifier name, and event name to create a corresponding Mirror Handler and adds this Mirror Handler in Mirror Notifier list. If the Mirror Notifier is not yet been created at this moment, server event manger will create a new one.
  6. When a BTT Notifier signals the event, the server event manager gets all Mirror Handlers in corresponding Mirror Notifier. If the Mirror Handler has a session ID then invokes CSServer.sendEvent() to send event to the Client. If the Mirror Handler don't have a session ID, then Mirror Handler sends event in message queue to BTT Handler.

When the application needs to send an event from the client to the server, it can use the method "registerServerInterestInEvent" in the client event manager to register the server workstation as a handler of the event. In the event manager's events table, the server TID is replaced by the identifier of the CSClient instance identifying the session between the two workstations. When the DSE Notifier signals the event, the client event manager's dispatch method sends the event to the server identified by the CSClient instance. When the server receive event, it sends event in message queue to BTT handlers that are interested in this event.