caerbannog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/caerbannog/queue.rb +6 -6
- data/lib/caerbannog/version.rb +1 -1
- data/lib/generators/templates/add_caerbannog_messages.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3a849e548199b8326a84a352fcbf2295cc8129d
|
4
|
+
data.tar.gz: 2d498780d9c153a173a2fc0d053d94eff8598a04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64a40908a3d218a6b98ca15d99e7c872f4b461cc902be4957829010fa85559f1d494ac781853e3c935230aa26b9041259671aea9c862c3114efbc250293c8073
|
7
|
+
data.tar.gz: 6b24a1f93c590c68b3a7042af9922c91d10a584674e5e2ff7df8469e641d35c975e0015d3a8ecb285a4f1a59879289292e037dfb7236dfa09e6d9895ffbb6249
|
data/lib/caerbannog/queue.rb
CHANGED
@@ -3,7 +3,7 @@ module Caerbannog
|
|
3
3
|
def self.push(name, payload)
|
4
4
|
raise ConfigurationError.new("Must configure #{self.name} with message_class") unless Caerbannog.message_class
|
5
5
|
|
6
|
-
Caerbannog.message_class.create!(:
|
6
|
+
Caerbannog.message_class.create!(name: name, payload: JSON.generate(payload))
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.rabbitmq(rabbit_url)
|
@@ -11,7 +11,7 @@ module Caerbannog
|
|
11
11
|
|
12
12
|
Bunny.run rabbit_url do |conn|
|
13
13
|
ch = conn.create_channel
|
14
|
-
exchange = ch.direct('events', :
|
14
|
+
exchange = ch.direct('events', durable: true)
|
15
15
|
yield exchange, ch
|
16
16
|
end
|
17
17
|
end
|
@@ -19,15 +19,15 @@ module Caerbannog
|
|
19
19
|
def self.subscribe(queue_name, *routing_keys, &block)
|
20
20
|
rabbitmq Caerbannog.rabbit_read_url do |exchange, channel|
|
21
21
|
queue = channel.queue(queue_name)
|
22
|
-
routing_keys.each { |routing_key| queue.bind(exchange, :
|
23
|
-
queue.subscribe(:
|
22
|
+
routing_keys.each { |routing_key| queue.bind(exchange, routing_key: routing_key) }
|
23
|
+
queue.subscribe(block: true, &block)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.publish(messages = MessagePoller.new(
|
27
|
+
def self.publish(messages = MessagePoller.new(Caerbannog.message_class))
|
28
28
|
rabbitmq Caerbannog.rabbit_write_url do |exchange|
|
29
29
|
messages.each do |message|
|
30
|
-
exchange.publish(message.payload, :
|
30
|
+
exchange.publish(message.payload, routing_key: message.name, persistent: true)
|
31
31
|
message.destroy
|
32
32
|
end
|
33
33
|
end
|
data/lib/caerbannog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caerbannog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dennis Rogenius
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2015-03-
|
17
|
+
date: 2015-03-30 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: rake
|