ScalaConsultants / reactive-rabbit

Reactive Streams driver for AMQP protocol. Powered by RabbitMQ library.
Apache License 2.0
184 stars 40 forks source link

ExecutionContext for asynchronous operations #30 #35

Closed LGLO closed 8 years ago

LGLO commented 8 years ago

Possibility to set ExecutorService for AMQConnection and ExecutionContext (derived from that ExecutorService) for dispatching Futures. Config parsing included.

LGLO commented 8 years ago

By default option from reference.conf nothing changed is behaviour unless one changes config.

mkiedys commented 8 years ago

Right now single thread pool is created and shared between all connections. This pool is shutdown after last connection is closed.

Proposed change modifies this behaviour:

It doesn't make sense to use fork join pools here because amqp-client blocks almost everywhere (exception is handleDelivery that is invoked asynchronously).

Can we start fresh with simply taking externally provided thread pool? RR will be almost always used together with Akka Streams and some dispatcher will be around. We can probably recommend Akka Streams IO dispatcher:

system.dispatchers.lookup(
  system.settings.config.getString("akka.stream.blocking-io-dispatcher")
)