eneter.messaging.messagingsystems.threadmessagingsystem
Class ThreadMessagingSystemFactory

java.lang.Object
  extended by eneter.messaging.messagingsystems.threadmessagingsystem.ThreadMessagingSystemFactory
All Implemented Interfaces:
IMessagingSystemFactory

public class ThreadMessagingSystemFactory
extends java.lang.Object
implements IMessagingSystemFactory

Messaging system delivering messages to the particular working thread. Each input channel is represented by its own working thread removing messages from the queue and processing them one by one.

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

Notice, the messages are always received in one particular working thread, but the notification events e.g. connection opened are invoked in a different thread.


Constructor Summary
ThreadMessagingSystemFactory()
          Constructs thread based messaging factory.
ThreadMessagingSystemFactory(IProtocolFormatter protocolFormatter)
          Constructs thread based messaging factory.
 
Method Summary
 IDuplexInputChannel createDuplexInputChannel(java.lang.String channelId)
          Creates the input channel receiving messages from the output channel and sending back response messages by using the working thread.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
          Creates the output channel sending messages to the input channel and receiving response messages by using the working thread.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId, java.lang.String responseReceiverId)
          Creates the output channel sending messages to the input channel and receiving response messages by using the working thread.
 IThreadDispatcherProvider getInputChannelThreading()
          Gets threading mode used for input channels.
 IThreadDispatcherProvider getOutputChannelThreading()
          Gets threading mode used for output channels.
 ThreadMessagingSystemFactory setInputChannelThreading(IThreadDispatcherProvider inputChannelThreading)
          Sets threading mode for input channels.
 ThreadMessagingSystemFactory 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

ThreadMessagingSystemFactory

public ThreadMessagingSystemFactory()
Constructs thread based messaging factory. Every instance of the synchronous messaging system factory represents one messaging system. It means that two instances of this factory creates channels for two independent (different) messaging system.


ThreadMessagingSystemFactory

public ThreadMessagingSystemFactory(IProtocolFormatter protocolFormatter)
Constructs thread based messaging factory. Every instance of the synchronous messaging system factory represents one messaging system. It means that two instances of this factory creates channels for two independent (different) messaging system.

Parameters:
protocolFormatter - low-level message formatter for the communication between channels.
Method Detail

createDuplexOutputChannel

public IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
                                               throws java.lang.Exception
Creates the output channel sending messages to the input channel and receiving response messages by using the working thread.

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 output channel sending messages to the input channel and receiving response messages by using the working thread.

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 input channel receiving messages from the output channel and sending back response messages by using the working thread.

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

setInputChannelThreading

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

Parameters:
inputChannelThreading - threading model
Returns:
this ThreadMessagingSystemFactory

getInputChannelThreading

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

Returns:
thread dispatcher

setOutputChannelThreading

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

Parameters:
outputChannelThreading -
Returns:
ThreadMessagingSystemFactory

getOutputChannelThreading

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

Returns:
thread dispatcher