eneter.messaging.messagingsystems.messagingsystembase
Interface IDuplexInputChannel


public interface IDuplexInputChannel

Duplex input channel which can receive messages from the duplex output channel and send response messages.


Method Summary
 void disconnectResponseReceiver(java.lang.String responseReceiverId)
          Disconnects the output channel.
 java.lang.String getChannelId()
          Returns address of this duplex input channel.
 IThreadDispatcher getDispatcher()
          Returns dispatcher that defines the threading model for raising events.
 boolean isListening()
          Returns true if the input channel is listening.
 Event<DuplexChannelMessageEventArgs> messageReceived()
          The event is raised when a message is received.
 Event<ResponseReceiverEventArgs> responseReceiverConnected()
          The event is raised when an output channel opened the connection.
 Event<ResponseReceiverEventArgs> responseReceiverDisconnected()
          The event is raised when an output channel closed the connection.
 void sendResponseMessage(java.lang.String responseReceiverId, java.lang.Object message)
          Sends a message to a connected output channel.
 void startListening()
          Starts listening to messages.
 void stopListening()
          Stops listening to messages.
 

Method Detail

responseReceiverConnected

Event<ResponseReceiverEventArgs> responseReceiverConnected()
The event is raised when an output channel opened the connection.


responseReceiverDisconnected

Event<ResponseReceiverEventArgs> responseReceiverDisconnected()
The event is raised when an output channel closed the connection. The event is not raised when the connection was closed by the input channel.


messageReceived

Event<DuplexChannelMessageEventArgs> messageReceived()
The event is raised when a message is received.


getChannelId

java.lang.String getChannelId()
Returns address of this duplex input channel.


startListening

void startListening()
                    throws java.lang.Exception
Starts listening to messages.

Throws:
java.lang.Exception

stopListening

void stopListening()
Stops listening to messages.


isListening

boolean isListening()
Returns true if the input channel is listening.


sendResponseMessage

void sendResponseMessage(java.lang.String responseReceiverId,
                         java.lang.Object message)
                         throws java.lang.Exception
Sends a message to a connected output channel. The following example shows how to send a broadcast message to all connected output channels:
 ...
 anInputChannel.sendResponseMessage("*", "Hello.");
 ...
 
 

Parameters:
responseReceiverId - Identifies the response receiver. The identifier comes with received messages. If the value is * then the input channel sends the message to all connected output channels.
message - response message
Throws:
java.lang.Exception

disconnectResponseReceiver

void disconnectResponseReceiver(java.lang.String responseReceiverId)
Disconnects the output channel.

Parameters:
responseReceiverId - Identifies output channel which shall be disconnected.
Throws:
java.lang.Exception

getDispatcher

IThreadDispatcher getDispatcher()
Returns dispatcher that defines the threading model for raising events. Dispatcher provides the threading model for responseReceiverConnected, responseReceiverDisconnected and messageReceived events. E.g. you can specify that received messages and raised events invoked always in one particular thread.