On Sun, Jul 3, 2016 at 5:14 AM, Arindam Mukherjee <
arindam.muker...@gmail.com> wrote:

> I am new to EventMachine and am integrating it with a Rails application. I
> intend to use the EventMachine reactor for connecting over AMQP
> (ruby-amqp), http/s as well as other protocols.
>

I recommend against this. Run your async code in a separate daemon. To
write from amqp from a rails app, you're likely better off with something
like bunny.

I start the EM loop in a separate thread, initialized via a Rails
> initializer script. But thereafter, if I intend to add new channels /
> queues, or connect to URLs, how do I add these resources to the EM reactor?
>
> 1. Is it using EM.next_tick?
>

You can use the EM.schedule API to send tasks to the reactor safely.


> 2. Is it by encapsulating access to the resource using a deferrable?
>

A deferrable object in EM is just a sort of promise. It makes no attempt to
address concurrency, locality, etc. It's just a container for some
callbacks.


> 3. Is it using EM::Queues?
>

EM::Queue is a convenience that does encapsulate running tasks on the
reactor thread. It is safe to push to EM::Queue from other threads.


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

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

Reply via email to