ScalaConsultants / reactive-rabbit

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

Passing ExecutionContext for asynchronous execution #30

Open LGLO opened 8 years ago

LGLO commented 8 years ago

Reactive streams (JVM) specification mandates some part of code to be executed synchronously (but quickly) and some other asynchronously. I think it is good idea to allow to pass ExecutionContext in each publish and consume method (as implicit with default ExecutionContext.Implicits.global).

LGLO commented 8 years ago

1st problem - cannot have two overloaded functions with default parameter value. So this change will break compilation. What do you think about renaming one version of publish? In fact I'd like to have publish which just wraps channel and takes messages with additional Exchange envelope. @mkiedys could you comment, please?

mkiedys commented 8 years ago

I would rather see it being provided only once per connection: preferebly in settings. Worth noticing is that we already use one thread pool: amqp-client creates two threads that await on connections and execute handlers. This is what would work best IHMO: thread pool provided via settings that is used by amqp-client and everywhere else.