eneter.messaging.messagingsystems.composites.messagebus
Interface IMessageBus


public interface IMessageBus

Message bus. The message bus is the component which can expose services. The service connects the message bus and registers its service id. When a client needs to use the service it connects the message bus and specifies the service id. If the service id exists the message bus establishes the connection between the client and the service.

The presence of the message bus is transparent for logic of services and their clients. The whole communication is realized via MessageBusMessagingFactory which ensures the interaction with the message bus.


Method Summary
 void attachDuplexInputChannels(IDuplexInputChannel serviceInputChannel, IDuplexInputChannel clientInputChannel)
          Attaches input channels which are used for the communication with the message bus.
 Event<MessageBusClientEventArgs> clientConnected()
          The event is raised when a client is connected to the service.
 Event<MessageBusClientEventArgs> clientDisconnected()
          The event is raised when a client is disconnected from the service.
 void detachDuplexInputChannels()
          Detaches input channels and stops the listening.
 void disconnectService(java.lang.String serviceAddress)
          Disconnect and unregisters the specified service.
 java.lang.String[] getConnectedClients(java.lang.String serviceAddress)
          Returns list of all clients connected to the specified service.
 java.lang.String[] getConnectedServices()
          Returns list of all connected services.
 int GetNumberOfConnectedClients(java.lang.String serviceAddress)
          Returns number of clients connected to the specified service.
 Event<MessageBusMessageEventArgs> messageToClientSent()
          The event is raised when a service sent a message to the client.
 Event<MessageBusMessageEventArgs> messageToServiceSent()
          The event is raised when a client sent a message to the service.
 Event<MessageBusServiceEventArgs> serviceRegistered()
          The event is raised when a new service is registered.
 Event<MessageBusServiceEventArgs> serviceUnregistered()
          The event is raised when a service is unregistered.
 

Method Detail

serviceRegistered

Event<MessageBusServiceEventArgs> serviceRegistered()
The event is raised when a new service is registered.

Returns:
event

serviceUnregistered

Event<MessageBusServiceEventArgs> serviceUnregistered()
The event is raised when a service is unregistered.

Returns:
event

clientConnected

Event<MessageBusClientEventArgs> clientConnected()
The event is raised when a client is connected to the service.

Returns:
event

clientDisconnected

Event<MessageBusClientEventArgs> clientDisconnected()
The event is raised when a client is disconnected from the service.

Returns:
event

messageToServiceSent

Event<MessageBusMessageEventArgs> messageToServiceSent()
The event is raised when a client sent a message to the service.

Returns:
event

messageToClientSent

Event<MessageBusMessageEventArgs> messageToClientSent()
The event is raised when a service sent a message to the client.

Returns:
event

attachDuplexInputChannels

void attachDuplexInputChannels(IDuplexInputChannel serviceInputChannel,
                               IDuplexInputChannel clientInputChannel)
                               throws java.lang.Exception
Attaches input channels which are used for the communication with the message bus. Once input channels are attached the message bus is listening and can be contacted by services and clients.

Parameters:
serviceInputChannel - input channel used by services.
clientInputChannel - input channel used by clients.
Throws:
java.lang.Exception

detachDuplexInputChannels

void detachDuplexInputChannels()
Detaches input channels and stops the listening.


getConnectedServices

java.lang.String[] getConnectedServices()
Returns list of all connected services.

Returns:
ids of all services which are registered in the message bus.

getConnectedClients

java.lang.String[] getConnectedClients(java.lang.String serviceAddress)
Returns list of all clients connected to the specified service.

Parameters:
serviceAddress - id of the service
Returns:
response receiver ids of connected clients

GetNumberOfConnectedClients

int GetNumberOfConnectedClients(java.lang.String serviceAddress)
Returns number of clients connected to the specified service. Using this method is faster than GetConnectedClients because it does not have to copy data.

Parameters:
serviceAddress - id of the service
Returns:
number of connected clients

disconnectService

void disconnectService(java.lang.String serviceAddress)
Disconnect and unregisters the specified service.

Parameters:
serviceAddress - id of the service that shall be unregistered