Class ZeroMqChannel

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, ExpressionCapable, IntegrationPattern, NamedComponent, IntegrationManagement, TrackableComponent, MessageChannel, SubscribableChannel, InterceptableChannel

public class ZeroMqChannel
extends AbstractMessageChannel
implements SubscribableChannel
The SubscribableChannel implementation over ZeroMQ sockets. It can work in two messaging models: - push-pull, where sent messages are distributed to subscribers in a round-robin manner according a respective ZeroMQ SocketType.PUSH and SocketType.PULL socket types logic; - pub-sub, where sent messages are distributed to all subscribers;

This message channel can work in local mode, when a pair of ZeroMQ sockets of SocketType.PAIR type are connected between publisher (send operation) and subscriber using inter-thread transport binding.

In distributed mode this channel has to be connected to an externally managed ZeroMQ proxy. The setConnectUrl(String) has to be as a standard ZeroMQ connect string, but with an extra port over the colon - representing a frontend and backend sockets pair on ZeroMQ proxy. For example: tcp://localhost:6001:6002. Another option is to provide a reference to the ZeroMqProxy instance managed in the same application: frontend and backend ports are evaluated from this proxy and the respective connection string is built from them.

This way sending and receiving operations on this channel are similar to interaction over a messaging broker.

An internal logic of this message channel implementation is based on the project Reactor using its Mono, Flux and Scheduler API for better thead model and flow control to avoid concurrency primitives for multi-publisher(subscriber) communication within the same application.

Since:
5.4
Author:
Artem Bilan