[zeromq-dev] Is it possible to add message priority on top of ZeroMQ?
Pieter Hintjens
ph at imatix.com
Sat Jun 1 10:33:22 CEST 2013
On Sat, Jun 1, 2013 at 4:09 AM, crocket <crockabiscuit at gmail.com> wrote:
> Imagine a situation where some messages are urgent and need to be delivered
> faster than low priority messages.
>
> ZeroMQ has no notion of message priority.
> Is it possible ever?
It's possible, it's easy, and it's built-in because ZeroMQ does fair
queuing on input, which gives the same result as message priorities
with much less complexity.
Let's say I have a pub-sub design and want to inject hi-priority
messages to subscribers. I'll create two PUB sockets and bind on
different endpoints. I use one for normal traffic and one for
high-priority messages. Subscribers connect to both endpoints and read
from their single SUB socket.
You can create as many priority levels as you like.
Currently this requires multiple TCP endpoints, but when we get around
to implementing ZMTP 3.0 it will work on a single endpoint since that
provides resource-based endpoints. E.g. zmq_bind
("tcp://*:9000/urgent")
-Pieter
More information about the zeromq-dev
mailing list