rails_push_queues 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d46b09ef2e2f78707f75cc07ed4d93b12fb5eb48
4
- data.tar.gz: c22924e57e7865334879f6db9fc5ce35f3aab412
3
+ metadata.gz: f0cc2b27470da56768230d5891c20b1be4723470
4
+ data.tar.gz: 64bd3042793b3f5feeefb1b9d449361cf8918608
5
5
  SHA512:
6
- metadata.gz: cbc2ae58ece7410f8890b1d1e760ed5155ad236dcc5d49c510d54efc0105b1f66f3ed29b9b620308a0c35103292c7d5a15b6e2510326d6acad1e46999041812b
7
- data.tar.gz: 19f99c8e7404646f5301ffeb34adf1de2c101b3ecc6a66d882928b63bba6dd0785f826b377442a982933238e707e6aa40370c63530c44b689703ca1e382fda7f
6
+ metadata.gz: 1bbbc4455c53141ba26462158edbbf51dd9b6d46d710096cf10502c469c40edca37e86074c2097a4a2bd3c8b5ce07c1ff32a9ec195c1259178c7274601529eb2
7
+ data.tar.gz: 6d43957ad03d7e9162385c778887d756027ec224e7153f6cdd62f9bdb6d476dba56b0556cf07f409b18d93bfdd5153356546ce54737a8cac3a9c1a6961e61804
data/README.md CHANGED
@@ -8,11 +8,20 @@ You can easily use Resque and/or Sidekiq workers without change.
8
8
 
9
9
  LINK TO iron config stuff, iron.json or ENV vars.
10
10
 
11
+ On Heroku, just add the IronMQ add on: `heroku addons:add iron_mq`
12
+
13
+
11
14
  ## Register the workers
12
15
 
13
16
  This is basically creating queues for each worker and setting your application as the subscriber.
14
17
 
15
18
  ```
16
- rake queues:subscribe ImageConversionWorker
19
+ rake queues:subscribe\[ImageConversionWorker,http://enigmatic-falls-123.herokuapp.com/queues/receive\]
20
+ ```
21
+
22
+ To verify the subscriber was added, you can run:
23
+
24
+ ```
25
+ rake queues:info\[ImageConversionWorker\]
17
26
  ```
18
27
 
@@ -7,13 +7,17 @@ class QueuesController < ApplicationController
7
7
  body = request.body.read
8
8
  p body
9
9
  json = JSON.parse(body)
10
- job = json["class"].constantize.new
11
- # the following is for Resque 2.X
12
- #json["vars"].each {|k, v| job.instance_variable_set("@#{k}", v) }
13
- #job.work
14
- args = json["args"]
15
- job.perform(*args)
16
- render :json => {"got"=>"it"}
10
+ begin
11
+ job = json["class"].constantize.new
12
+ # the following is for Resque 2.X
13
+ #json["vars"].each {|k, v| job.instance_variable_set("@#{k}", v) }
14
+ #job.work
15
+ args = json["args"]
16
+ job.perform(*args)
17
+ render :json => {"got" => "it"}
18
+ rescue Exception => ex
19
+ render :status => 500, :json => {"error"=>"#{ex.message}"}
20
+ end
17
21
  end
18
22
 
19
23
  end
@@ -13,7 +13,7 @@ module Sidekiq
13
13
 
14
14
  def perform_async(*args)
15
15
  clz = self
16
- RailsPushQueues.queue_job
16
+ RailsPushQueues.queue_job(clz, args)
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module RailsPushQueues
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -4,8 +4,15 @@
4
4
  # end
5
5
 
6
6
  namespace :queues do
7
- task :subscribe, :clz, :host do |t, args|
8
- puts "task args"
9
- p args
7
+ task :subscribe, [:clz, :url] do |t, args|
8
+ mq = IronMQ::Client.new
9
+ q = mq.queue(args.clz.to_s)
10
+ q.add_subscriber(url: args.url)
10
11
  end
11
- end
12
+
13
+ task :info, [:clz] do |t, args|
14
+ mq = IronMQ::Client.new
15
+ q = mq.queue(args.clz.to_s)
16
+ p q.info
17
+ end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_push_queues
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder