eneter.messaging.messagingsystems.udpmessagingsystem
Class UdpMessagingSystemFactory

java.lang.Object
  extended by eneter.messaging.messagingsystems.udpmessagingsystem.UdpMessagingSystemFactory
All Implemented Interfaces:
IMessagingSystemFactory

public class UdpMessagingSystemFactory
extends java.lang.Object
implements IMessagingSystemFactory

Messaging system delivering messages via UDP. It creates the communication channels using UDP for sending and receiving messages. The channel id must be a valid UDP URI address. E.g.: udp://127.0.0.1:6080/.
The messaging via UDP supports unicast, multicast and broadcast communication.
The unicast communication is the routing of messages from one sender to one receiver. (E.g. a client-service communication where a client sends messages to one service and the service can send response messages to one client.)
The multicast communication is the routing of messages from one sender to multiple receivers (the receivers which joined the specific multicast group and listen to the specific port). The broadcast communication is the routing of messages from one sender to all receivers within the sub-net which listen to the specific port.

UDP unicast communication.
Unicast input channel:

 
 // Create UDP input channel.
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory();
 IDuplexInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://127.0.0.1:8043/");
 
 // Subscribe for receiving messages.
 anInputChannel.messageReceived().subscribe(myOnMessageReceived);
 
 // Start listening.
 anInputChannel.startListening();
 
 ...
 
 // Stop listening.
 anInputChannel.stopListening();
 
 
 // Handling of messages.
 private void onMessageReceived(object sender, DuplexChannelMessageEventArgs e)
 {
     // Handle incoming message.
     ....
     
     // Send response message.
     IDuplexInputChannel anInputChannel = (IDuplexInputChannel)sender;
     anInputChannel.sendResponseMessage(e.ResponseReceiverId, "Hi");
 }
 private EventHandler<DuplexChannelMessageEventArgs> myOnMessageReceived = new EventHandler<DuplexChannelMessageEventArgs>()
 {
     @Override
     public void onEvent(Object sender, DuplexChannelMessageEventArgs e)
     {
         onMessageReceived(sender, e);
     }
 };
 
 
Unicast output channel:
 
 // Create UDP output channel.
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory();
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://127.0.0.1:8043/");
 
 // Subscribe to receive messages.
 anOutputChannel.responseMessageReceived().subscribe(myOnResponseMessageReceived);
 
 // Open the connection.
 anOutputChannel.openConnection();
 
 ...
 
 // Send a message.
 anOutputChannel.sendMessage("Hello");
 
 ...
 // Close connection.
 anOutputChannel.closeConnection();
 
 
 // Handling of received message.
 private void onResponseMessageReceived(object sender, DuplexChannelMessageEventArgs e)
 {
     string aMessage = (string)e.Message;
     ....
 }
 
 private EventHandler<DuplexChannelMessageEventArgs> myOnResponseMessageReceived = new EventHandler<DuplexChannelMessageEventArgs>()
 {
     @Override
     public void onEvent(Object sender, DuplexChannelMessageEventArgs e)
     {
         onResponseMessageReceived(sender, e);
     }
 };
 
 


UDP multicast communication.
Multicast input channel:
 
 // Create UDP input channel.
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory()
    // The communication will be multicast or broadcast.
    .setUnicastCommunication(false)
    // The multicast group which shall be joined.
    .setMulticastGroupToReceive("234.5.6.7");
 
 // This input channel will be able to receive messages sent to udp://127.0.0.1:8043/ or
 // to the multicast group udp://234.5.6.7:8043/.
 IDuplexInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://127.0.0.1:8043/")
 
 
 // Subscribe for receiving messages.
 anInputChannel.messageReceived().subscribe(myOnMessageReceived);
 
 // Start listening.
 anInputChannel.startListening();
 
 ...
 
 // Stop listening.
 anInputChannel.stopListening();
 
 
 // Handling of messages.
 private void onMessageReceived(object sender, DuplexChannelMessageEventArgs e)
 {
     // Handle incoming message.
     ....
     
     // Send response message.
     IDuplexInputChannel anInputChannel = (IDuplexInputChannel)sender;
     anInputChannel.sendResponseMessage(e.ResponseReceiverId, "Hi");
 }
 
 private EventHandler<DuplexChannelMessageEventArgs> myOnMessageReceived = new EventHandler<DuplexChannelMessageEventArgs>()
 {
     @Override
     public void onEvent(Object sender, DuplexChannelMessageEventArgs e)
     {
         onMessageReceived(sender, e);
     }
 };
 
 
Output channel sending messages to the multicast group.
 
 // Create UDP output channel which will send messages to the multicast group udp://234.5.6.7:8043/.
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory()
    // The communication will be multicast or broadcast.
    .setUnicastCommunication(false);
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://234.5.6.7:8043/");
 
 // Subscribe to receive messages.
 anOutputChannel.responseMessageReceived(myOnResponseMessageReceived);
 
 // Open the connection.
 anOutputChannel.openConnection();
 
 ...
 
 // Send a message to all receivers which have joined
 // the multicast group udp://234.5.6.7:8043/.
 anOutputChannel.sendMessage("Hello");
 
 ...
 // Close connection.
 anOutputChannel.closeConnection();
 
 
 // Handling of received message.
 private void onResponseMessageReceived(object sender, DuplexChannelMessageEventArgs e)
 {
     string aMessage = (string)e.Message;
     ....
 }
 
 private EventHandler<DuplexChannelMessageEventArgs> myOnResponseMessageReceived = new EventHandler<DuplexChannelMessageEventArgs>()
 {
     @Override
     public void onEvent(Object sender, DuplexChannelMessageEventArgs e)
     {
         onResponseMessageReceived(sender, e);
     }
 };
 
 


Constructor Summary
UdpMessagingSystemFactory()
          Constructs the UDP messaging factory.
UdpMessagingSystemFactory(IProtocolFormatter protocolFromatter)
          Constructs the UDP messaging factory.
 
Method Summary
 IDuplexInputChannel createDuplexInputChannel(java.lang.String channelId)
          Creates the duplex input channel which can receive and send messages to the duplex output channel using UDP.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
          Creates duplex output channel which can send and receive messages from the duplex input channel using UDP.
 IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId, java.lang.String responseReceiverId)
          Creates duplex output channel which can send and receive messages from the duplex input channel using UDP.
 boolean getAllowSendingBroadcasts()
          Gets whether sending of broadcasts is allowed.
 IThreadDispatcherProvider getInputChannelThreading()
          Gets threading mode used for input channels.
 java.lang.String getMulticastGroupToReceive()
          Gets the multicast group to receive messages from.
 boolean getMulticastLoopback()
          Returns whether the sender can receive the multicast message which sent in itself.
 IThreadDispatcherProvider getOutputChannelThreading()
          Gets threading mode used for output channels.
 int getResponseReceiverPort()
          Returns port number which shall be used for receiving response messages in unicast communication.
 boolean getReuseAddress()
          Gets the flag indicating whether the socket can be bound to the address which is already used.
 int getTtl()
          Gets time to live value for UDP datagrams.
 boolean getUnicastCommunication()
          Gets whether the communication is unicast.
 UdpMessagingSystemFactory setAllowSendingBroadcasts(boolean allowBroadcasts)
          Enables / disables sending broadcast messages.
 UdpMessagingSystemFactory setInputChannelThreading(IThreadDispatcherProvider inputChannelThreading)
          Sets threading mode for input channels.
 UdpMessagingSystemFactory setMulticastGroupToReceive(java.lang.String multicastGroup)
          Sets the multicast group to receive messages from.
 UdpMessagingSystemFactory setMulticastLoopback(boolean allowMulticastLoopback)
          Enables /disables receiving multicast messages from the same IP address from which they were sent.
 UdpMessagingSystemFactory setOutputChannelThreading(IThreadDispatcherProvider outputChannelThreading)
          Sets threading mode for output channels.
 UdpMessagingSystemFactory setResponseReceiverPort(int port)
          Sets or gets the port which shall be used for receiving response messages by output channel in case of unicast communication.
 UdpMessagingSystemFactory setReuseAddress(boolean allowReuseAddressFlag)
          Sets the flag indicating whether the socket can be bound to the address which is already used.
 UdpMessagingSystemFactory setTtl(int ttl)
          Sets time to live value for UDP datagrams.
 UdpMessagingSystemFactory setUnicastCommunication(boolean isUnicast)
          Sets whether the communication is unicast.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpMessagingSystemFactory

public UdpMessagingSystemFactory()
Constructs the UDP messaging factory.


UdpMessagingSystemFactory

public UdpMessagingSystemFactory(IProtocolFormatter protocolFromatter)
Constructs the UDP messaging factory.

Parameters:
protocolFromatter - formatter used for low-level messaging between output and input channels
Method Detail

createDuplexOutputChannel

public IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId)
                                               throws java.lang.Exception
Creates duplex output channel which can send and receive messages from the duplex input channel using UDP. It can create duplex output channels for unicast, multicast or broadcast communication. If the property UnicastCommunication is set to true then it creates the output channel for the unicast communication. It means it can send messages to one particular input channel and receive messages only from that input channel. If the property UnicastCommunication is set to false then it creates the output channel for mulitcast or broadcast communication. It means it can send mulitcast or broadcast messages which can be received by multiple input channels. It can also receive multicast and broadcast messages.

Creating the duplex output channel for unicast communication (e.g. for client-service communication).
 
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory();
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://127.0.0.1:8765/");
 
 
Creating the duplex output channel for sending mulitcast messages (e.g. for streaming video to multiple receivers).
 
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
    // Setup the factory to create channels for mulitcast or broadcast communication.
    .setUnicastCommunication(false);
 
 // Create output channel which will send messages to the mulitcast group 234.4.5.6 on the port 8765.
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://234.4.5.6:8765/");
 
 
Creating the duplex output channel for sending broadcast messages.
 
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
    // Setup the factory to create channels for mulitcast or broadcast communication.
    .setUnicastCommunication(false)
    // Setup the factory to create chennels which are allowed to send broadcast messages.
    .setAllowSendingBroadcasts(true);
 
 // Create output channel which will send broadcast messages to the port 8765.
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://255.255.255.255:8765/");
 
 

Specified by:
createDuplexOutputChannel in interface IMessagingSystemFactory
Parameters:
channelId - UDP address in a valid URI format e.g. udp://127.0.0.1:8090/
Returns:
output channel
Throws:
java.lang.Exception

createDuplexOutputChannel

public IDuplexOutputChannel createDuplexOutputChannel(java.lang.String channelId,
                                                      java.lang.String responseReceiverId)
                                               throws java.lang.Exception
Creates duplex output channel which can send and receive messages from the duplex input channel using UDP. It can create duplex output channels for unicast, multicast or broadcast communication. If the property UnicastCommunication is set to true then it creates the output channel for the unicast communication. It means it can send messages to one particular input channel and receive messages only from that input channel. If the property UnicastCommunication is set to false then it creates the output channel for mulitcast or broadcast communication. It means it can send mulitcast or broadcast messages which can be received by multiple input channels. It can also receive multicast and broadcast messages.

This method allows to specify the id of the created output channel.
Creating the duplex output channel for unicast communication (e.g. for client-service communication) with a specific output channel id.
 
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory();
 String aSessionId = UUID.randomUUID().toString();
 IDuplexOutputChannel anOutputChannel = aMessaging.CreateDuplexOutputChannel("udp://127.0.0.1:8765/", aSessionId);
 
 
Creating the duplex output channel which can send messages to a particular UDP address and which can recieve messages on a specific UDP address and which can receive mulitcast messages.
 
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
    // Setup the factory to create channels for mulitcast or broadcast communication.
    .setUnicastCommunication(false)
    // Specify the mulitcast group to receive messages from.
    .setMulticastGroupToReceive("234.4.5.6");
 
 // Create output channel which can send messages to the input channel listening to udp://127.0.0.1:8095/
 // and which is listening to udp://127.0.0.1:8099/ and which can also receive messages sent for the mulitcast
 // group 234.4.5.6.
 IDuplexOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://127.0.0.1:8095/", "udp://127.0.0.1:8099/");
 
 

Specified by:
createDuplexOutputChannel in interface IMessagingSystemFactory
Parameters:
channelId - Identifies the receiving duplex input channel. The channel id must be a valid URI address e.g. udp://127.0.0.1:8090/
responseReceiverId - Unique identifier of the output channel.
In unicast communication the identifier can be a string e.g. GUID which represents the session between output and input channel.
In mulitcast or broadcast communication the identifier must be a valid URI address which will be used by the output channel to receive messages from input channels.

If the parameter is null then in case of unicast communication a unique id is generated automatically. In case of multicast or broadcast communication the address udp://0.0.0.0:0/ is used which means the the output channel will listen to random free port on all available IP addresses.
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 which can receive and send messages to the duplex output channel using UDP. It can create duplex input channels for unicast, multicast or broadcast communication. If the property UnicastCommunication is set to true then it creates the input channel for the unicast communication. It means, like a service it can receive connections and messages from multiple output channels but send messages only to particular output channels which are connected. If the property UnicastCommunication is set to false then it creates the output channel for mulitcast or broadcast communication. It means it can send mulitcast or broadcast messages which can be received by multiple output channels. It also can receive multicast and broadcast messages.

Creating the duplex input channel for unicast communication.
 
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory();
 IDuplexInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://127.0.0.1:8765/");
 
 
Creating the duplex input channel for multicast communication.
 
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
    // Setup the factory to create channels for mulitcast or broadcast communication.
    .setUnicastCommunication(false)
    // Specify the mulitcast group to receive messages from.
    .setMulticastGroupToReceive("234.4.5.6");
 
 // Create duplex input channel which is listening to udp://127.0.0.1:8095/ and can also receive multicast messages
 // sent to udp://234.4.5.6:8095/.
 IDuplexInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://127.0.0.1:8095/");
 
 
Sending mulitcast and broadcast messages from the duplex input channel.
 
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
    // Setup the factory to create channels for mulitcast or broadcast communication.
    .setUnicastCommunication(false)
    // Setup the factory to create chennels which are allowed to send broadcast messages.
    .setAllowSendingBroadcasts(true);
 
 // Create duplex input channel which is listening to udp://127.0.0.1:8095/.
 IDuplexInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://127.0.0.1:8095/");
 
 // Subscribe to handle messages.
 anIputChannel.messageReceived().subscribe(myOnMessageReceived);
 
 // Start listening.
 anIputChannel.startListening();
 
 ...
 
 // Send a multicast message.
 // Note: it will be received by all output and input channels which have joined the multicast group 234.4.5.6
 // and are listening to the port 8095.
 anInputChannel.sendResponseMessage("udp://234.4.5.6:8095/", "Hello");
 
 ...
 
 // Send a broadcast message.
 // Note: it will be received by all output and input channels within the sub-network which are listening to the port 8095.
 anInputChannel.sendResponseMessage("udp://255.255.255.255:8095/", "Hello");
 
 ...
 
 // Stop listening.
 anInputChannel.stopListening();
 
 

Specified by:
createDuplexInputChannel in interface IMessagingSystemFactory
Parameters:
channelId - Identifies this duplex input channel. The channel id must be a valid URI address (e.g. udp://127.0.0.1:8090/) the input channel will listen to.
Returns:
input channel
Throws:
java.lang.Exception

setUnicastCommunication

public UdpMessagingSystemFactory setUnicastCommunication(boolean isUnicast)
Sets whether the communication is unicast. If true the factory will create channels for unicast communication. The unicast is the communication between one sender and one receiver. It means if a sender sends a message it is routed to one particular receiver. The client-service communication is an example of the unicast communication. When the client sends a request message it is delivered to one service. Then when the service sends a response message it is delivered to one client.
If false the factory will create channels for multicast or broadcast communication which is the communication between one sender and several receivers. It means when a sender sends a mulitcast or a broadcast message the message may be delivered to multiple receivers. E.g. in case of video streaming the sender does not send data packets individually to each receiver but it sends it just ones and routers multiply it and deliver it to all receivers.

Parameters:
isUnicast - if true the communication is unicast. If false the communication is multicast or broadcast.
Returns:
instance of this UdpMessagingSystemFactory.

getUnicastCommunication

public boolean getUnicastCommunication()
Gets whether the communication is unicast. The unicast is the communication between one sender and one receiver. It means if a sender sends a message it is routed to one particular receiver. The client-service communication is an example of the unicast communication. When the client sends a request message it is delivered to one service. Then when the service sends a response message it is delivered to one client.
If false the factory will create channels for multicast or broadcast communication which is the communication between one sender and several receivers. It means when a sender sends a mulitcast or a broadcast message the message may be delivered to multiple receivers. E.g. in case of video streaming the sender does not send data packets individually to each receiver but it sends it just ones and routers multiply it and deliver it to all receivers.

Returns:
true if the communication is unicast. It returns false if the communication is multicast or broadcast.

setTtl

public UdpMessagingSystemFactory setTtl(int ttl)
Sets time to live value for UDP datagrams. When an UDP datagram is traveling across the network each router decreases its TTL value by one. Once the value is decreased to 0 the datagram is discarded. Therefore the TTL value specifies how many routers a datagram can traverse.
E.g. if the value is set to 1 the datagram will not leave the local network.
The default value is 128.

Parameters:
ttl - number of routers the datagram can travel.
Returns:
instance of this UdpMessagingSystemFactory.

getTtl

public int getTtl()
Gets time to live value for UDP datagrams. When an UDP datagram is traveling across the network each router decreases its TTL value by one. Once the value is decreased to 0 the datagram is discarded. Therefore the TTL value specifies how many routers a datagram can traverse.
E.g. if the value is set to 1 the datagram will not leave the local network.
The default value is 128.

Returns:
number of routers the datagram can travel.

setMulticastGroupToReceive

public UdpMessagingSystemFactory setMulticastGroupToReceive(java.lang.String multicastGroup)
Sets the multicast group to receive messages from. Multicast group (multicast address) is a an IP address which is from the range 224.0.0.0 - 239.255.255.255. (The range from 224.0.0.0 to 224.0.0.255 is reserved for low-level routing protocols and you should not use it in your applications.) Receiving messages from the mulitcast group means the communication is not unicast but mulitcast. Therefore to use this property UnicastCommunication must be set to false.

Creating input channel which can receive multicast messages.
 
 // Create UDP messaging factory using simple protocol formatter.
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 UdpMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
     // Setup messaging factory to create channels for mulitcast or broadcast communication.
     .setUnicastCommunication(false)
     // Set the multicast group which shall be joined for receiving messages.
     .setMulticastGroupToReceive("234.5.6.7");
 
 // Create input channel which will listen to udp://192.168.30.1:8043/ and which will also
 // receive messages from the multicast group udp://234.5.6.7:8043/.
 IInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://192.168.30.1:8043/");
 
 
Creating output channel which can send multicast messages.
 
 // Create UDP messaging factory using simple protocol formatter.
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 UdpMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter)
     // Setup messaging factory to create channels for mulitcast or broadcast communication.
     .setUnicastCommunication(false);
 
 // Create output channel which can send messages to the multicast address udp://234.5.6.7:8043/.
 IOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://234.5.6.7:8043/");
 
 

Parameters:
multicastGroup - multicast group which shall be joined e.g. "234.5.6.7"
Returns:
instance of this UdpMessagingSystemFactory.

getMulticastGroupToReceive

public java.lang.String getMulticastGroupToReceive()
Gets the multicast group to receive messages from.

Returns:
multicast group

setAllowSendingBroadcasts

public UdpMessagingSystemFactory setAllowSendingBroadcasts(boolean allowBroadcasts)
Enables / disables sending broadcast messages. Broadcast is a message which is routed to all devices within the sub-network. To be able to send broadcasts UnicastCommunication must be set to false.

Output channel which can send broadcast messages to all input channels within the sub-network which listen to the port 8055.
 
 // Create UDP messaging factory using simple protocol formatter.
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 UdpMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter);
 
 // Setup messaging factory to create channels for mulitcast or broadcast communication.
 aMessaging.setUnicastCommunication(false);
 
 // Enable sending broadcasts.
 aMessaging.setAllowSendingBroadcasts(true);
 
 // Create output channel which will send broadcast messages to all devices within the sub-network
 // which listen to the port 8055.
 IOutputChannel anOutputChannel = aMessaging.createDuplexOutputChannel("udp://255.255.255.255:8055/");
 
 // Initialize output channel for sending broadcast messages and receiving responses.
 anOutputChannel.openConnection();
 
 // Send UDP broadcast.
 anOutputChannel.sendMessage("Hello");
 
 ...
 
 // Close channel - it will release listening thread.
 anOutputChannel.closeConnection();
 
 
Input channel which can receive broadcast messages.
 
 // Create UDP messaging factory using simple protocol formatter.
 IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter();
 UdpMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter);
 
 // Setup messaging factory to create channels for mulitcast or broadcast communication.
 aMessaging.setUnicastCommunication(false);
 
 // Create input channel which can receive broadcast messages to the port 8055.
 IInputChannel anInputChannel = aMessaging.createDuplexInputChannel("udp://0.0.0.0:8055/");
 
 // Subscribe to receive messages.
 anInputChannel.messageReceived().subscribe(myOnMessageReceived);
 
 // Start listening for messages.
 anInputChannel.startListening();
 
 ...
 
 // Stop listening.
 anInputChannel.stopListening();
 
 

Parameters:
allowBroadcasts - tru if sending of broadcasts is allowed.
Returns:
instance of this UdpMessagingSystemFactory.

getAllowSendingBroadcasts

public boolean getAllowSendingBroadcasts()
Gets whether sending of broadcasts is allowed.

Returns:
true if sending of broadcasts is allowed.

setMulticastLoopback

public UdpMessagingSystemFactory setMulticastLoopback(boolean allowMulticastLoopback)
Enables /disables receiving multicast messages from the same IP address from which they were sent. In case the sender sends a message to the same multicast group and port as itself has joined this value specifies whether it shall also receive the message or not. It means if it shall send the message to itself. If the value is true then yes the message will be delivered to sender too. Default value is true.

Parameters:
allowMulticastLoopback - true if the message shall be delivered to sender too.
Returns:
instance of this UdpMessagingSystemFactory.

getMulticastLoopback

public boolean getMulticastLoopback()
Returns whether the sender can receive the multicast message which sent in itself.

Returns:
true if it can receive it.

setResponseReceiverPort

public UdpMessagingSystemFactory setResponseReceiverPort(int port)
Sets or gets the port which shall be used for receiving response messages by output channel in case of unicast communication. When a client connects an IP address and port for the unicast communication a random free port is assigned for receiving messages. This property allows to use a specific port instead of random one. This property works only for the unicast communication.

Default value is -1 which means a random free port is chosen for receiving response messages.

Parameters:
port - port number which shall be used for receiving response messages.
Returns:
instance of this UdpMessagingSystemFactory.

getResponseReceiverPort

public int getResponseReceiverPort()
Returns port number which shall be used for receiving response messages in unicast communication. Default value is -1 which means a random free port is chosen for receiving response messages.

Returns:
port number which shall be used for receiving response messages.

setInputChannelThreading

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

Parameters:
inputChannelThreading - threading model
Returns:
instance of this UdpMessagingSystemFactory.

getInputChannelThreading

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

Returns:
dispatcher providing the threading mode.

setOutputChannelThreading

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

Parameters:
outputChannelThreading -
Returns:
instance of this UdpMessagingSystemFactory.

getOutputChannelThreading

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

Returns:
dispatcher providing the threading mode.

setReuseAddress

public UdpMessagingSystemFactory setReuseAddress(boolean allowReuseAddressFlag)
Sets the flag indicating whether the socket can be bound to the address which is already used.

Parameters:
allowReuseAddressFlag - true if the socket can bound address and port which is already in use.
Returns:
instance of this UdpMessagingSystemFactory.

getReuseAddress

public boolean getReuseAddress()
Gets the flag indicating whether the socket can be bound to the address which is already used.

Returns:
true if the socket can bound address and port which is already in use.