eneter.messaging.messagingsystems.synchronousmessagingsystem
Class SynchronousMessagingSystemFactory

java.lang.Object
  extended by eneter.messaging.messagingsystems.synchronousmessagingsystem.SynchronousMessagingSystemFactory
All Implemented Interfaces:
IMessagingSystemFactory

public class SynchronousMessagingSystemFactory
extends java.lang.Object
implements IMessagingSystemFactory

Messaging system delivering messages synchronously within the calling thread (like a method call). It creates output and input channels using the caller thread to deliver messages. It means e.g. if the output channel calls sendMessage(...) then when the input channel receives the message in the same thread.

Different instances of SynchronousMessagingSystemFactory are independent and so they are different messaging systems. Therefore if you want to send/receive a message through this messaging system then output and input channels must be created with the same instance of SynchronousMessagingSystemFactory.


Constructor Summary
SynchronousMessagingSystemFactory()
          Constructs the factory representing the messaging system.
SynchronousMessagingSystemFactory(IProtocolFormatter protocolFormatter)
          Constructs the factory representing the messaging system.
 
Method Summary
 IDuplexInputChannel createDuplexInputChannel(java.lang.String channelId)
          Creates the duplex input channel listening to messages on the specified channel id.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
          Creates the duplex output channel communicating with the specified duplex input channel using synchronous local call.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId, java.lang.String responseReceiverId)
          Creates the duplex output channel communicating with the specified duplex input channel using synchronous local call.
 IThreadDispatcherProvider getInputChannelThreading()
          Gets threading mode used for input channels.
 IThreadDispatcherProvider getOutputChannelThreading()
          Gets threading mode used for output channels.
 SynchronousMessagingSystemFactory setInputChannelThreading(IThreadDispatcherProvider inputChannelThreading)
          Sets threading mode for input channels.
 SynchronousMessagingSystemFactory setOutputChannelThreading(IThreadDispatcherProvider outputChannelThreading)
          Sets threading mode for output channels.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronousMessagingSystemFactory

public SynchronousMessagingSystemFactory()
Constructs the factory representing the messaging system. Note: Every instance of the synchronous messaging system factory represents one messaging system. It means that two instances of this factory class creates channels for two independent messaging system.


SynchronousMessagingSystemFactory

public SynchronousMessagingSystemFactory(IProtocolFormatter protocolFormatter)
Constructs the factory representing the messaging system.

Parameters:
protocolFormatter - formatter used to encode low-level messages between channels
Method Detail

createDuplexOutputChannel

public IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
                                               throws java.lang.Exception
Creates the duplex output channel communicating with the specified duplex input channel using synchronous local call. The duplex output channel can send messages and receive response messages.

Specified by:
createDuplexOutputChannel in interface IMessagingSystemFactory
Parameters:
channelId - address of the input channel.
Returns:
output channel
Throws:
java.lang.Exception

createDuplexOutputChannel

public IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId,
                                                      java.lang.String responseReceiverId)
                                               throws java.lang.Exception
Creates the duplex output channel communicating with the specified duplex input channel using synchronous local call. The duplex output channel can send messages and receive response messages.

Specified by:
createDuplexOutputChannel in interface IMessagingSystemFactory
Parameters:
channelId - address of the input channel.
responseReceiverId - unique identifier of the output channel. If the value is null then the identifier is genearated automatically
Returns:
duplex output channel
Throws:
java.lang.Exception

createDuplexInputChannel

public IDuplexInputChannel createDuplexInputChannel(java.lang.String channelId)
                                             throws java.lang.Exception
Creates the duplex input channel listening to messages on the specified channel id. The duplex input channel can send response messages back to the duplex output channel.

Specified by:
createDuplexInputChannel in interface IMessagingSystemFactory
Parameters:
channelId - address of the input channel.
Returns:
input channel
Throws:
java.lang.Exception

setInputChannelThreading

public SynchronousMessagingSystemFactory setInputChannelThreading(IThreadDispatcherProvider inputChannelThreading)
Sets threading mode for input channels.

Parameters:
inputChannelThreading - threading model
Returns:

getInputChannelThreading

public IThreadDispatcherProvider getInputChannelThreading()
Gets threading mode used for input channels.

Returns:

setOutputChannelThreading

public SynchronousMessagingSystemFactory setOutputChannelThreading(IThreadDispatcherProvider outputChannelThreading)
Sets threading mode for output channels.

Parameters:
outputChannelThreading -
Returns:

getOutputChannelThreading

public IThreadDispatcherProvider getOutputChannelThreading()
Gets threading mode used for output channels.

Returns: