Pregunta

Is there a way to manually launch a Sidekiq process without using Ruby, but by posting the appropriate message into Redis? There must be some sort of convention for the message that it expects.

¿Fue útil?

Otros consejos

Not sure why you would do this, but from its documentation: "Sidekiq is compatible with Resque. It uses the exact same message format as Resque so it can integrate into an existing Resque processing farm." I know that Resque enqueues a hash of data as a string:

"{\"class\":\"NoOpWorker\",\"args\":[]}"

You can manually verify this by enqueuing a job at a console with:

Resque.enqueue_to "foo", NoOpWorker

And then see what the data is with a redis-cli command

redis-cli lrange resque:queue:foo 0 100

But before proceeding, why would you want to do this? Why not just run a script or a rake task that would use enqueue the job through Sidekiq's normal API instead of hacking around it?

EDIT: Are you trying to interop between technologies?

Redis doesn't know anything about Ruby or Sidekiq.

So yeah, it's possible. It might require some work, and you might have to take versioning of the non-public (well, it is open source after all, so anything is public) API into account.

You could write a separate client process in any programming language, and analyze the redis keyspace. Read up on the implementation of the Sidekiq serialization. A quick look (I don't use Sidekiq) reveals that it uses simple JSON serialization: sidekiq/api.rb .

Hope this helps, TW

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top