Class ZeroMqMessageHandlerSpec

All Implemented Interfaces:
DisposableBean, FactoryBean<ReactiveMessageHandlerAdapter>, InitializingBean, Lifecycle, Phased, SmartLifecycle, ComponentsRegistration

public class ZeroMqMessageHandlerSpec extends ReactiveMessageHandlerSpec<ZeroMqMessageHandlerSpec,ZeroMqMessageHandler>
Since:
5.4
Author:
Artem Bilan, Alessio Matricardi
  • Constructor Details

    • ZeroMqMessageHandlerSpec

      protected ZeroMqMessageHandlerSpec(org.zeromq.ZContext context, String connectUrl)
      Create an instance based on the provided ZContext and connection string.
      Parameters:
      context - the ZContext to use for creating sockets.
      connectUrl - the URL to connect the socket to.
    • ZeroMqMessageHandlerSpec

      protected ZeroMqMessageHandlerSpec(org.zeromq.ZContext context, Supplier<String> connectUrl)
      Create an instance based on the provided ZContext and connection string supplier.
      Parameters:
      context - the ZContext to use for creating sockets.
      connectUrl - the supplier for URL to connect the socket to.
      Since:
      5.5.9
    • ZeroMqMessageHandlerSpec

      protected ZeroMqMessageHandlerSpec(org.zeromq.ZContext context, String connectUrl, org.zeromq.SocketType socketType)
      Create an instance based on the provided ZContext, connection string and SocketType.
      Parameters:
      context - the ZContext to use for creating sockets.
      connectUrl - the URL to connect the socket to.
      socketType - the SocketType to use; only SocketType.PAIR, SocketType.PUB and SocketType.PUSH are supported.
    • ZeroMqMessageHandlerSpec

      protected ZeroMqMessageHandlerSpec(org.zeromq.ZContext context, Supplier<String> connectUrl, org.zeromq.SocketType socketType)
      Create an instance based on the provided ZContext, connection string supplier and SocketType.
      Parameters:
      context - the ZContext to use for creating sockets.
      connectUrl - the supplier for URL to connect the socket to.
      socketType - the SocketType to use; only SocketType.PAIR, SocketType.PUB and SocketType.PUSH are supported.
  • Method Details

    • messageMapper

      public ZeroMqMessageHandlerSpec messageMapper(OutboundMessageMapper<byte[]> messageMapper)
      Provide an OutboundMessageMapper to convert a request message into byte[] for sending into ZeroMq socket.
      Parameters:
      messageMapper - the OutboundMessageMapper to use.
      Returns:
      the spec
    • messageConverter

      public ZeroMqMessageHandlerSpec messageConverter(MessageConverter messageConverter)
      Provide a MessageConverter (as an alternative to messageMapper(org.springframework.integration.mapping.OutboundMessageMapper<byte[]>)) for converting a request message into byte[] for sending into ZeroMq socket.
      Parameters:
      messageConverter - the MessageConverter to use.
      Returns:
      the spec
    • socketConfigurer

      public ZeroMqMessageHandlerSpec socketConfigurer(Consumer<org.zeromq.ZMQ.Socket> socketConfigurer)
      Provide a Consumer to configure a socket with arbitrary options, like security.
      Parameters:
      socketConfigurer - the configurer for socket options.
      Returns:
      the spec
    • topic

      public ZeroMqMessageHandlerSpec topic(String topic)
      Specify a topic the SocketType.PUB socket is going to use for distributing messages into the subscriptions. It is ignored for all other SocketTypes supported.
      Parameters:
      topic - the topic to use.
      Returns:
      the spec
    • wrapTopic

      public ZeroMqMessageHandlerSpec wrapTopic(boolean wrapTopic)
      Specify if the topic that SocketType.PUB socket is going to use for distributing messages into the subscriptions must be wrapped with an additional empty frame. It is ignored for all other SocketTypes supported. This attribute is set to true by default.
      Parameters:
      wrapTopic - true if the topic must be wrapped with an additional empty frame.
      Returns:
      the spec
      Since:
      6.2.6
    • topicFunction

      public ZeroMqMessageHandlerSpec topicFunction(Function<Message<?>,String> topicFunction)
      Specify a Function to evaluate a topic a SocketType.PUB is going to use for distributing messages into the subscriptions.It is ignored for all other SocketTypes supported.
      Parameters:
      topicFunction - the Function to evaluate topic for publishing.
      Returns:
      the spec
    • topicExpression

      public ZeroMqMessageHandlerSpec topicExpression(String topicExpression)
      Specify a SpEL expression to evaluate a topic a SocketType.PUB is going to use for distributing messages into the subscriptions.It is ignored for all other SocketTypes supported.
      Parameters:
      topicExpression - the expression to evaluate topic for publishing.
      Returns:
      the spec
    • topicExpression

      public ZeroMqMessageHandlerSpec topicExpression(Expression topicExpression)
      Specify a SpEL expression to evaluate a topic a SocketType.PUB is going to use for distributing messages into the subscriptions.It is ignored for all other SocketTypes supported.
      Parameters:
      topicExpression - the expression to evaluate topic for publishing.
      Returns:
      the spec