This is OK and a fairly common thing to do to pass channels around like this. 
Sharing channels when publishing is a no-no but due to the way consumer 
operations are dispatched in the underlying Java client, you have linear 
invocation of your callback.

What is not safe to do in your case is acing multiple messages at once (given 
that you pass deliveries to other threads, there will be a race condition 
between acks that may "overlap").

I recall a discussion of this on GitHub or rabbitmq-users where I explained 
this in a lot more detail. It was in the last few months.

MK

> On 18/8/2015, at 19:30, Dave Tenny <dave.te...@gmail.com> wrote:
> 
> I was thinking this was bad for the following reasons
> We're using the channel passed to the callback after exit from the callback, 
> which seems philosophically like some abuse of argument lifetime/extent, but 
> which may in fact be fine.  Thoughts?
> We're using the channel asynchronously from another thread, and there is 
> documentation that says channel operations are not all thread safe.
> If #1 is acceptable, then I'll just wrap the channel usage in a (locking 
> channel ....) form in the subscriber callback and callback-external 
> asynchronous job processor doing the ack.

-- 
You received this message because you are subscribed to the Google Groups 
"clojure-rabbitmq" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure-rabbitmq+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to