DuoSRX

Xavier Perez

DuoSRX

Paris, France

KissKissBankBank

http://xavier-perez.com

Check out snippets of the blog postings. Click on the link to view the full post at the original site as the author intended.

Enqueuing Sidekiq Jobs Without Sidekiq

5/25/2014

Let’s say you have a running Sidekiq system and for whatever reason you need to enqueue jobs from another not ruby-based environment or system. It’s actually quite simple as you can directly push your jobs into Redis without the Sidekiq gem.

First, let’s create a very simple worker and enqueue it:

1
2
3
4
5
6
7
8
9
10
class HardWorker
  include Sidekiq::Worker

  def perform(name)
    puts "Hey, I'm a worker named #{name}"
  end
end

HardWorker.perform_async("foo")
# => "d34299988658f23c62c178da"

Sidekiq gives us back a unique ID for that specific job. Let’s have a look inside Redis:

1
2
3
4
5
6
7
8
redis 127.0.0.1:6379> type "queues"
set

redis 127.0.0.1:6379&
[...]

Enqueuing Sidekiq Jobs Without Sidekiq

5/25/2014

Let’s say you have a running Sidekiq system and for whatever reason you need to enqueue jobs from another not ruby-based environment or system. It’s actually quite simple as you can directly push your jobs into Redis without the Sidekiq gem.

First, let’s create a very simple worker and enqueue it:

1
2
3
4
5
6
7
8
9
10
class HardWorker
  include Sidekiq::Worker

  def perform(name)
    puts "Hey, I'm a worker named #{name}"
  end
end

HardWorker.perform_async("foo")
# => "d34299988658f23c62c178da"

Sidekiq gives us back a unique ID for that specific job. Let’s have a look inside Redis:

1
2
3
4
5
6
7
8
redis 127.0.0.1:6379> type "queues"
set

redis 127.0.0.1:6379&
[...]

Enqueuing Sidekiq Jobs Without Sidekiq

5/25/2014

Let’s say you have a running Sidekiq system and for whatever reason you need to enqueue jobs from another not ruby-based environment or system. It’s actually quite simple as you can directly push your jobs into Redis without the Sidekiq gem.

First, let’s create a very simple worker and enqueue it:

1
2
3
4
5
6
7
8
9
10
class HardWorker
  include Sidekiq::Worker

  def perform(name)
    puts "Hey, I'm a worker named #{name}"
  end
end

HardWorker.perform_async("foo")
# => "d34299988658f23c62c178da"

Sidekiq gives us back a unique ID for that specific job. Let’s have a look inside Redis:

1
2
3
4
5
6
7
8
redis 127.0.0.1:6379> type "queues"
set

redis 127.0.0.1:6379&
[...]

Enqueuing Sidekiq Jobs Without Sidekiq

5/25/2014

Let’s say you have a running Sidekiq system and for whatever reason you need to enqueue jobs from another not ruby-based environment or system. It’s actually quite simple as you can directly push your jobs into Redis without the Sidekiq gem.

First, let’s create a very simple worker and enqueue it:

1
2
3
4
5
6
7
8
9
10
class HardWorker
  include Sidekiq::Worker

  def perform(name)
    puts "Hey, I'm a worker named #{name}"
  end
end

HardWorker.perform_async("foo")
# => "d34299988658f23c62c178da"

Sidekiq gives us back a unique ID for that specific job. Let’s have a look inside Redis:

1
2
3
4
5
6
7
8
redis 127.0.0.1:6379> type "queues"
set

redis 127.0.0.1:6379&
[...]