G
G
GeneAYak2019-08-12 23:53:33
Ruby on Rails
GeneAYak, 2019-08-12 23:53:33

How to make Hanami (or Rails) and EventsMachine friends?

I have a small application on Hanami, the complexity is slightly more complicated than the tutorial.
I want to attach a message broker to it, the choice fell on NATS. But their main gem runs on top of EventsMachine.
Accordingly, when I initialize it, the thread is captured by the event loop and my entire application stops.
I don’t want to split it into two applications for the sake of reusing models.
I understand that you need to either look in the direction of trends or fork.
Actually, the question is, how is it done correctly? When forking, how to stop both threads when the application stops?
PS I'm aiming for hanami, but the examples on the rails will also do
PS2 app for myself, super performance is not required

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question