org.springframework.integration.ip.udp
Class MulticastSendingMessageHandler

java.lang.Object
  extended by org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
      extended by org.springframework.integration.ip.udp.UnicastSendingMessageHandler
          extended by org.springframework.integration.ip.udp.MulticastSendingMessageHandler
All Implemented Interfaces:
java.lang.Runnable, CommonSocketOptions, MessageHandler

public class MulticastSendingMessageHandler
extends UnicastSendingMessageHandler

A MessageHandler implementation that maps a Message into a UDP datagram packet and sends that to the specified multicast address (224.0.0.0 to 239.255.255.255) and port. The only difference between this and its super class is the ability to specify how many acknowledgments are required to determine success.

Since:
2.0
Author:
Gary Russell

Field Summary
protected  int timeToLive
           
 
Fields inherited from class org.springframework.integration.ip.udp.UnicastSendingMessageHandler
ackControl, ackCounter, ackPort, ackSocket, ackTimeout, fatalException, mapper, socket, soReceiveBufferSize, waitForAck
 
Fields inherited from class org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
destinationAddress, executorService, host, logger, port, soSendBufferSize, soTimeout
 
Constructor Summary
MulticastSendingMessageHandler(java.lang.String address, int port)
          Constructs a MulticastSendingMessageHandler to send data to the multicast address/port.
MulticastSendingMessageHandler(java.lang.String address, int port, boolean lengthCheck)
          Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the lengthCheck option (if set, a length is prepended to the packet and checked at the destination).
MulticastSendingMessageHandler(java.lang.String address, int port, boolean lengthCheck, boolean acknowledge, java.lang.String ackHost, int ackPort, int ackTimeout)
          Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the acknowledge option, where the destination sends a receipt acknowledgment.
MulticastSendingMessageHandler(java.lang.String address, int port, boolean acknowledge, java.lang.String ackHost, int ackPort, int ackTimeout)
          Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the acknowledge option, where the destination sends a receipt acknowledgment.
 
Method Summary
protected  java.net.DatagramSocket getSocket()
           
 void setMinAcksForSuccess(int minAcksForSuccess)
          If acknowledge = true; how many acks needed for success.
 void setTimeToLive(int timeToLive)
          Set the underlying MulticastSocket time to live property.
 
Methods inherited from class org.springframework.integration.ip.udp.UnicastSendingMessageHandler
handleMessage, restartAckThread, run, send, setReliabilityAttributes, setSocketAttributes, setSoReceiveBufferSize, shutDown
 
Methods inherited from class org.springframework.integration.ip.AbstractInternetProtocolSendingMessageHandler
getPort, setSoSendBufferSize, setSoTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeToLive

protected int timeToLive
Constructor Detail

MulticastSendingMessageHandler

public MulticastSendingMessageHandler(java.lang.String address,
                                      int port)
Constructs a MulticastSendingMessageHandler to send data to the multicast address/port.

Parameters:
address - The multicast address.
port - The port.

MulticastSendingMessageHandler

public MulticastSendingMessageHandler(java.lang.String address,
                                      int port,
                                      boolean lengthCheck)
Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the lengthCheck option (if set, a length is prepended to the packet and checked at the destination).

Parameters:
address - The multicast address.
port - The port.
lengthCheck - Enable the lengthCheck option.

MulticastSendingMessageHandler

public MulticastSendingMessageHandler(java.lang.String address,
                                      int port,
                                      boolean acknowledge,
                                      java.lang.String ackHost,
                                      int ackPort,
                                      int ackTimeout)
Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the acknowledge option, where the destination sends a receipt acknowledgment.

Parameters:
address - The multicast address.
port - The port.
acknowledge - Whether or not acknowledgments are required.
ackHost - The host to which acknowledgments should be sent; required if acknowledge is true.
ackPort - The port to which acknowledgments should be sent; required if acknowledge is true.
ackTimeout - How long to wait (milliseconds) for an acknowledgment.

MulticastSendingMessageHandler

public MulticastSendingMessageHandler(java.lang.String address,
                                      int port,
                                      boolean lengthCheck,
                                      boolean acknowledge,
                                      java.lang.String ackHost,
                                      int ackPort,
                                      int ackTimeout)
Constructs a MulticastSendingMessageHandler to send data to the multicast address/port and enables setting the acknowledge option, where the destination sends a receipt acknowledgment.

Parameters:
address - The multicast address.
port - The port.
lengthCheck - Enable the lengthCheck option.
acknowledge - Whether or not acknowledgments are required.
ackHost - The host to which acknowledgments should be sent; required if acknowledge is true.
ackPort - The port to which acknowledgments should be sent; required if acknowledge is true.
ackTimeout - How long to wait (milliseconds) for an acknowledgment.
Method Detail

setMinAcksForSuccess

public void setMinAcksForSuccess(int minAcksForSuccess)
If acknowledge = true; how many acks needed for success.

Parameters:
minAcksForSuccess -

setTimeToLive

public void setTimeToLive(int timeToLive)
Set the underlying MulticastSocket time to live property.

Parameters:
timeToLive - MulticastSocket.setTimeToLive(int)

getSocket

protected java.net.DatagramSocket getSocket()
                                     throws java.io.IOException
Overrides:
getSocket in class UnicastSendingMessageHandler
Throws:
java.io.IOException