akira/exq

Communicate between rails and phoenix using exq and Sidekiq

pradosh987 opened this issue · 3 comments

I am trying to add bridge between Rails and Phoenix framework to communicate. So far I can enqueue jobs in rails and those are picked up by Exq in phoenix framework.

Sidekiq::Client.push({"queue" => "elixir_queue", "class" => "ElixirQueue", "args" => ["foo"]})

But I am having issue enqueueing job from Elixir for rails to pick up. I tried this and it enqueues job

Exq.enqueue(Exq, "rails_queue", 'RailsQueueJob' , ["Hello there rails"],  max_retries: 0) 

but Sidekiq on rails side throws error saying "error_message\":\"undefined method jid=' for #< RailsQueueJob:0x00007fe599dfda50>. There happens to be no documentation for this. How can I Enqueue from elixir and let Sidekiq pick up the job.

Note: I am using ActiveJobs

class RailsQueueJob < ApplicationJob
  attr_accessor :jid
  queue_as : rails_queue

  def perform(*args)
    # Do something later
    puts("Processing incoming message #{args.inspect}")
  end
end

Apparently adding attr_accessor :jid to ActiveJob fixes the issue. Seems like a bug with Sidekiq - ActiveJob interface?

Could you run redis-cli monitor and find what is the difference between sidekiq.push and exq.enqueue. The job structure used should be compatible.

It's a rails related issue.
sidekiq/sidekiq#3073