Class TcpOutboundGatewaySpec

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, DisposableBean, FactoryBean<TcpOutboundGateway>, InitializingBean, Lifecycle, Phased, SmartLifecycle, ComponentsRegistration

public class TcpOutboundGatewaySpec extends MessageHandlerSpec<TcpOutboundGatewaySpec,TcpOutboundGateway> implements ComponentsRegistration
Since:
5.0
Author:
Gary Russell, Artem Bilan
  • Field Details

  • Constructor Details

    • TcpOutboundGatewaySpec

      public TcpOutboundGatewaySpec(AbstractClientConnectionFactory connectionFactoryBean)
      Construct an instance using an existing spring-managed connection factory.
      Parameters:
      connectionFactoryBean - the spring-managed bean.
    • TcpOutboundGatewaySpec

      public TcpOutboundGatewaySpec(TcpClientConnectionFactorySpec<?,?> connectionFactorySpec)
      Construct an instance using the supplied connection factory spec.
      Parameters:
      connectionFactorySpec - the spec.
  • Method Details

    • remoteTimeout

      public TcpOutboundGatewaySpec remoteTimeout(long remoteTimeout)
      Parameters:
      remoteTimeout - the remote timeout to set.
      Returns:
      the spec.
      See Also:
    • remoteTimeout

      public <P> TcpOutboundGatewaySpec remoteTimeout(Function<Message<P>,?> remoteTimeoutFunction)
      Configure a Function that will be invoked at runtime to determine the destination to which a message will be sent. Typically used with a Java 8 Lambda expression:
       
       .remoteTimeout(m -> m.getHeaders().get('rto'))
       
       
      Type Parameters:
      P - the message payload type.
      Parameters:
      remoteTimeoutFunction - the function.
      Returns:
      the spec.
      See Also:
    • closeStreamAfterSend

      public TcpOutboundGatewaySpec closeStreamAfterSend(boolean closeStreamAfterSend)
      Set to true to close the connection output stream after sending without closing the connection. Use to signal EOF to the server, such as when using a ByteArrayRawSerializer. Requires a single-use connection factory.
      Parameters:
      closeStreamAfterSend - true to close.
      Returns:
      the spec.
      Since:
      5.2
    • async

      public TcpOutboundGatewaySpec async(boolean async)
      Set to true to release the sending thread and receive the reply asynchronously.
      Parameters:
      async - true for asynchronous request/reply.
      Returns:
      the spec.
      Since:
      5.3
    • unsolictedMessageChannelName

      public TcpOutboundGatewaySpec unsolictedMessageChannelName(String channelName)
      Set the unsolicited message channel name.
      Parameters:
      channelName - the name.
      Returns:
      the spec.
      Since:
      5.4
    • unsolictedMessageChannelName

      public TcpOutboundGatewaySpec unsolictedMessageChannelName(MessageChannel channel)
      Set the unsolicited message channel.
      Parameters:
      channel - the channel.
      Returns:
      the spec.
      Since:
      5.4
    • getComponentsToRegister

      public Map<Object,String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface ComponentsRegistration