Class ZeroMqChannelSpec

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

public class ZeroMqChannelSpec extends MessageChannelSpec<ZeroMqChannelSpec,ZeroMqChannel>
Since:
5.4
Author:
Artem Bilan
  • Constructor Details

    • ZeroMqChannelSpec

      protected ZeroMqChannelSpec(org.zeromq.ZContext context, boolean pubSub)
  • Method Details

    • connectUrl

      public ZeroMqChannelSpec connectUrl(String connectUrl)
      Configure a connection to the ZeroMQ proxy with the pair of ports over colon for proxy frontend and backend sockets. Mutually exclusive with the zeroMqProxy(ZeroMqProxy).
      Parameters:
      connectUrl - the connection string in format PROTOCOL://HOST:FRONTEND_PORT:BACKEND_PORT, e.g. tcp://localhost:6001:6002
      Returns:
      the spec
    • zeroMqProxy

      public ZeroMqChannelSpec zeroMqProxy(ZeroMqProxy zeroMqProxy)
      Specify a reference to a ZeroMqProxy instance in the same application to rely on its ports configuration and make a natural lifecycle dependency without guessing when the proxy is started. Mutually exclusive with the connectUrl(String).
      Parameters:
      zeroMqProxy - the ZeroMqProxy instance to use
      Returns:
      the spec
    • consumeDelay

      public ZeroMqChannelSpec consumeDelay(Duration consumeDelay)
      Specify a Duration to delay consumption when no data received.
      Parameters:
      consumeDelay - the Duration to delay consumption when empty; defaults to ZeroMqChannel.DEFAULT_CONSUME_DELAY.
      Returns:
      the spec
    • messageMapper

      public ZeroMqChannelSpec messageMapper(BytesMessageMapper messageMapper)
      Provide a BytesMessageMapper to convert to/from messages when send or receive happens on the sockets.
      Parameters:
      messageMapper - the BytesMessageMapper to use.
      Returns:
      the spec
    • sendSocketConfigurer

      public ZeroMqChannelSpec sendSocketConfigurer(Consumer<org.zeromq.ZMQ.Socket> sendSocketConfigurer)
      The Consumer callback to configure a publishing socket.
      Parameters:
      sendSocketConfigurer - the Consumer to use.
      Returns:
      the spec
    • subscribeSocketConfigurer

      public ZeroMqChannelSpec subscribeSocketConfigurer(Consumer<org.zeromq.ZMQ.Socket> subscribeSocketConfigurer)
      The Consumer callback to configure a consuming socket.
      Parameters:
      subscribeSocketConfigurer - the Consumer to use.
      Returns:
      the spec