Hi,

Most of the readers of this mailing list probably know that James has
been using project reactor [1], an implementation of Reactive Streams,
to improve its usage of resources and lower the latency of operations
for some time.

For a long time, the Mailbox part of James has a Pub/Sub system to
allow for modular extension of James default behavior like learning for
Spam, indexing in ElasticSearch, etc.

Recenlty, we reworked that Pub/Sub to be able to implement a
distributed version of it by integrating RabbitMQ.

During this work we wrote an extensive test suite to define the right
contracts a Mailbox Pub/Sub system should support and we reworked the
single-node version (called InVmEventBus) to rely on reactor.

However, listeners are still not able to make use of reactive streams
because we didn't changed the way listeners work.

You can either have a synchronous listener: it means that for a given
event, the delivery method call with return only when all listeners got
called (or an error occured) or an asynchronous listener, which
basically means we won't wait for the listener return to go ahead.

When a listener does some IO, like for example ElasticSearch indexer,
we don't leverage the fact that IO are asynchronous and thus we block
threads waiting for the IO.

Given everything is reactor based, it would be a much better use of
resources to let the listeners work with `Publisher` type and use non-
block APIs.

We could probably provide an adapter API to allow non-reactive
listeners to use the traditional API and wrapping listener calls into
some reactive types.

What would you think about this change? Feedback is more than welcome.

Cheers,


[1] https://projectreactor.io


-- 
Matthieu Baechler


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to