Possible to temporarily specify a different redis sever? #689

Closed
brandonparsons opened this Issue Feb 7, 2013 · 3 comments

Comments

2 participants
@brandonparsons

The fix for issue #524 allows you to use a simple string for the Sidekiq worker - allowing you to push a job for a worker class not in your current codebase.

I'm wondering how to use this to push to a Sidekiq queue from another app with its own Sidekiq installation & Redis connection?

e.g.

App1 and App2 are separate, but related applications.

App1 : Sidekiq1 & RedisConnection1
App2: Sidekiq2 & RedisConnection2

App1 wants to push a job onto App2's queue. This would normally be possible as a result of fix for issue #524 , but since it has its own separate Sidekiq instance, we've already done a Sidekiq.configure_client and Sidekiq.configure_server.

Is there some way to temporarily specify a new redis server and then push a job?

e.g., from App1:

redis_connection2 = Redis.new url: 'RedisConnection2' 
Sidekiq::Client.with(redis_connection2).push(  job_for_app2_worker )

Thanks!

@mperham

This comment has been minimized.

Show comment Hide comment
@mperham

mperham Feb 7, 2013

Owner

There's not enough demand for this feature to add it to Sidekiq proper. Easiest would be to roll your own method from scratch.

Owner

mperham commented Feb 7, 2013

There's not enough demand for this feature to add it to Sidekiq proper. Easiest would be to roll your own method from scratch.

@brandonparsons

This comment has been minimized.

Show comment Hide comment
@brandonparsons

brandonparsons Feb 7, 2013

Thanks for the quick reply!

Just to clarify - the best way then would be to essentially copy the code
you have inside Sidekiq (specifically) the Sidekiq::Client.push method and
just manually push into the second Redis connection myself? I've got a
working protoype of this going - essentially just build the hash myself,
multi_json.encode, and push onto the Sidekiq queue.

I'm assuming that the format for keys & job hashes that Sidekiq will use is
stable (i.e. this is a relatively safe thing to do?)

Thanks for your work on Sidekiq.

On Thu, Feb 7, 2013 at 1:40 PM, Mike Perham notifications@github.comwrote:

There's not enough demand for this feature to add it to Sidekiq proper.
Easiest would be to roll your own method from scratch.


Reply to this email directly or view it on GitHubhttps://github.com/mperham/sidekiq/issues/689#issuecomment-13258366.

Thanks for the quick reply!

Just to clarify - the best way then would be to essentially copy the code
you have inside Sidekiq (specifically) the Sidekiq::Client.push method and
just manually push into the second Redis connection myself? I've got a
working protoype of this going - essentially just build the hash myself,
multi_json.encode, and push onto the Sidekiq queue.

I'm assuming that the format for keys & job hashes that Sidekiq will use is
stable (i.e. this is a relatively safe thing to do?)

Thanks for your work on Sidekiq.

On Thu, Feb 7, 2013 at 1:40 PM, Mike Perham notifications@github.comwrote:

There's not enough demand for this feature to add it to Sidekiq proper.
Easiest would be to roll your own method from scratch.


Reply to this email directly or view it on GitHubhttps://github.com/mperham/sidekiq/issues/689#issuecomment-13258366.

@mperham

This comment has been minimized.

Show comment Hide comment
@mperham

mperham Feb 7, 2013

Owner

Yes, the format is stable. Sounds like you've already got an good handle on what needs to happen.

Owner

mperham commented Feb 7, 2013

Yes, the format is stable. Sounds like you've already got an good handle on what needs to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment