Is there a way to pass object as arguments value in Resque-workers.
I want to do something like this Resque.enqueue(SomeWorker, obj)
instead of Resque.enqueue(SomeWorker, id)
my object is of different kind which does not have id.
Appreciate any help.
as a best practice, you should never pass a real object to a worker.
the idea is that you pass a minimum of information to your worker, idealy an id, so that the worker can retrieve the rest of the information itself.
since the data is persisted in redis, you would actually need to somehow marshal your object when queuing it and then unmarshal it when the worker retrieves the data.
if your object is just holding some data you should think about passing this as a hash, cause they are easily persistable within redis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With