Class MulticastSendingMessageHandler

java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
All Implemented Interfaces:
Runnable, org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.core.Ordered, org.springframework.integration.context.ExpressionCapable, org.springframework.integration.context.Orderable, org.springframework.integration.IntegrationPattern, CommonSocketOptions, org.springframework.integration.support.context.NamedComponent, org.springframework.integration.support.management.IntegrationManagement, org.springframework.integration.support.management.ManageableLifecycle, org.springframework.integration.support.management.TrackableComponent, org.springframework.messaging.MessageHandler, reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>

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
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement

    org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides
  • Field Summary

    Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport

    EXPRESSION_PARSER, logger

    Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement

    METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    MulticastSendingMessageHandler(String destinationExpression)
    Construct MulticastSendingMessageHandler based on the destination SpEL expression to determine the target destination at runtime against requestMessage.
    Constructs a MulticastSendingMessageHandler to send data to the multicast address/port.
    MulticastSendingMessageHandler(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(String address, int port, boolean lengthCheck, boolean acknowledge, 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(String address, int port, boolean acknowledge, 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(org.springframework.expression.Expression destinationExpression)
    Construct MulticastSendingMessageHandler based on the destination SpEL expression to determine the target destination at runtime against requestMessage.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    convertAndSend(org.springframework.messaging.Message<?> message)
     
    protected DatagramSocket
     
    void
    setLocalAddress(String localAddress)
    On a multi-homed system, specifies the ip address of the network interface used to communicate.
    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.handler.AbstractMessageHandler

    handleMessage, onComplete, onError, onNext, onSubscribe, setObservationConvention

    Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport

    buildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack

    Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport

    afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface reactor.core.CoreSubscriber

    currentContext

    Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement

    getThisAs

    Methods inherited from interface org.springframework.integration.support.context.NamedComponent

    getBeanName, getComponentName
  • Constructor Details

    • MulticastSendingMessageHandler

      public MulticastSendingMessageHandler(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(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(String address, int port, boolean acknowledge, 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(String address, int port, boolean lengthCheck, boolean acknowledge, 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.
    • MulticastSendingMessageHandler

      public MulticastSendingMessageHandler(org.springframework.expression.Expression destinationExpression)
      Construct MulticastSendingMessageHandler based on the destination SpEL expression to determine the target destination at runtime against requestMessage.
      Parameters:
      destinationExpression - the SpEL expression to evaluate the target destination at runtime. Must evaluate to String, URI or SocketAddress.
      Since:
      5.0
    • MulticastSendingMessageHandler

      public MulticastSendingMessageHandler(String destinationExpression)
      Construct MulticastSendingMessageHandler based on the destination SpEL expression to determine the target destination at runtime against requestMessage.
      Parameters:
      destinationExpression - the SpEL expression to evaluate the target destination at runtime. Must evaluate to String, URI or SocketAddress.
      Since:
      5.0
  • Method Details

    • getSocket

      protected DatagramSocket getSocket() throws IOException
      Overrides:
      getSocket in class UnicastSendingMessageHandler
      Throws:
      IOException
    • setMinAcksForSuccess

      public void setMinAcksForSuccess(int minAcksForSuccess)
      If acknowledge = true; how many acks needed for success.
      Parameters:
      minAcksForSuccess - The minimum number of acks that will represent success.
    • setTimeToLive

      public void setTimeToLive(int timeToLive)
      Set the underlying MulticastSocket time to live property.
      Parameters:
      timeToLive - MulticastSocket.setTimeToLive(int)
    • setLocalAddress

      public void setLocalAddress(String localAddress)
      Description copied from interface: CommonSocketOptions
      On a multi-homed system, specifies the ip address of the network interface used to communicate. For inbound adapters and gateways, specifies the interface used to listed for incoming connections. If omitted, the endpoint will listen on all available adapters. For the UDP multicast outbound adapter specifies the interface to which multicast packets will be sent. For UDP unicast and multicast adapters, specifies which interface to which the acknowledgment socket will be bound. Does not apply to TCP outbound adapters and gateways.
      Specified by:
      setLocalAddress in interface CommonSocketOptions
      Overrides:
      setLocalAddress in class UnicastSendingMessageHandler
      Parameters:
      localAddress - The local address.
    • convertAndSend

      protected void convertAndSend(org.springframework.messaging.Message<?> message) throws IOException, URISyntaxException
      Overrides:
      convertAndSend in class UnicastSendingMessageHandler
      Throws:
      IOException
      URISyntaxException