eneter.messaging.messagingsystems.messagingsystembase
Interface IDuplexOutputChannel


public interface IDuplexOutputChannel

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


Method Summary
 void closeConnection()
          Closes the connection with the input channel.
 Event<DuplexChannelEventArgs> connectionClosed()
          The event is raised when the connection was closed from the input channel or the it was closed due to a broken connection.
 Event<DuplexChannelEventArgs> connectionOpened()
          The event is raised when the connection with the input channel was opened.
 java.lang.String getChannelId()
          Returns the address of the input channel.
 IThreadDispatcher getDispatcher()
          Returns dispatcher which defines the threading model for received messages and raised events.
 java.lang.String getResponseReceiverId()
          Returns the unique identifier of this output channel.
 boolean isConnected()
          Returns true if the output channel is connected to the input channel and listens to response messages.
 void openConnection()
          Opens the connection with the input channel.
 Event<DuplexChannelMessageEventArgs> responseMessageReceived()
          The event is raised when a response message was received.
 void sendMessage(java.lang.Object message)
          Sends the message to the input channel.
 

Method Detail

connectionOpened

Event<DuplexChannelEventArgs> connectionOpened()
The event is raised when the connection with the input channel was opened.


connectionClosed

Event<DuplexChannelEventArgs> connectionClosed()
The event is raised when the connection was closed from the input channel or the it was closed due to a broken connection. The event is not raised if the connection was closed by the output channel by calling closeConnection().


responseMessageReceived

Event<DuplexChannelMessageEventArgs> responseMessageReceived()
The event is raised when a response message was received.


getChannelId

java.lang.String getChannelId()
Returns the address of the input channel. The channel id represents the communication address. The syntax of the channel id depends on the chosen communication. If the messaging is based on WebSocket the address will look like ws://127.0.0.1:7345/Something/. If the communication is based on tcp the address would be e.g.: tcp://127.0.0.1:7435/.


getResponseReceiverId

java.lang.String getResponseReceiverId()
Returns the unique identifier of this output channel.


sendMessage

void sendMessage(java.lang.Object message)
                 throws java.lang.Exception
Sends the message to the input channel.

Parameters:
message - message to be sent. It can be String or byte[] or some other type depending on used protocol formatter.
Throws:
java.lang.Exception

openConnection

void openConnection()
                    throws java.lang.Exception
Opens the connection with the input channel.

Throws:
java.lang.Exception

closeConnection

void closeConnection()
Closes the connection with the input channel.


isConnected

boolean isConnected()
Returns true if the output channel is connected to the input channel and listens to response messages.


getDispatcher

IThreadDispatcher getDispatcher()
Returns dispatcher which defines the threading model for received messages and raised events. Dispatcher is responsible for raising connectionOpened, connectionClosed and responseMessageReceived events. E.g. it can ensure all messages and events are invoked in one particular thread.