1

I'm trying to integrate NATS into a Rails server in order to process jobs. Since there isn't a good NATS based job system I'm going to reuse a standard gem like Que.

My process would be: nats message -> a Rails something doing pull_subscribe() and a blocking .fetch() -> inserts a job into Que (this could be any other gem eg delayed_job)

My question is how do I listen to NATS messages without yet another separate process? Can I have an initializer that does Thread.new { nats.pull_subscribe; nats.fetch } (which blocks)? If yes, what is the performance impact? Will a puma thread be blocked?

MB.
  • 4,167
  • 8
  • 52
  • 79

0 Answers0