amqp_notifier 0.0.5 → 0.0.7b

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.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{amqp_notifier}
5
- s.version = "0.0.5"
5
+ s.version = "0.0.7b"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Pau"]
9
- s.date = %q{2011-05-06}
8
+ s.authors = ["Pau","TLmaK0"]
9
+ s.date = %q{2011-11-21}
10
10
  s.description = %q{AMQP & Qusion helper class}
11
11
  s.email = %q{pau@nosolopau.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/amqp_notifier.rb"]
data/lib/amqp_notifier.rb CHANGED
@@ -15,11 +15,11 @@ class AmqpNotifier
15
15
  def publish(key = '', message = '')
16
16
  $stderr.puts "#{key}:"
17
17
  $stderr.puts "#{message}"
18
- Qusion.channel.topic(@exchange, @options).publish(message, :key => @key_prefix + key)
18
+ Qusion.channel.topic(@exchange, @options).publish(message, {:key => @key_prefix + key, :timestamp => (Time.now.to_f*1000).truncate})
19
19
  end
20
20
 
21
21
  def subscribe(key = '', &block)
22
- $stdout.puts "Subscriction to Exchange: #{@exchange} Queue: #{@queue} Key: #{key}"
22
+ $stdout.puts "Subscription to Exchange: #{@exchange} Queue: #{@queue} Key: #{key}"
23
23
  Qusion.channel.prefetch(1).queue(@queue, :durable => true).bind(Qusion.channel.topic(@exchange, @options), :key => key).subscribe(:ack => true) do |info, message|
24
24
  for i in (0..RETRIES)
25
25
  begin
@@ -31,8 +31,12 @@ class AmqpNotifier
31
31
  $stderr.puts "#{e.inspect}:"
32
32
  e.backtrace.each {|line| $stderr.puts line}
33
33
  if i == RETRIES
34
- AmqpNotifier.new("#{@exchange}_errors").publish(key, message)
35
- info.reject(:requeue => false)
34
+ begin
35
+ AmqpNotifier.new("#{@exchange}_errors").publish(key, message)
36
+ info.reject(:requeue => false)
37
+ rescue
38
+ $stderr.puts "Error sending message to exchange #{@exchange}_errors"
39
+ end
36
40
  else
37
41
  sleep(1)
38
42
  next
@@ -41,4 +45,4 @@ class AmqpNotifier
41
45
  end
42
46
  end
43
47
  end
44
- end
48
+ end
metadata CHANGED
@@ -1,20 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amqp_notifier
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 7b
9
+ version: 0.0.7b
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pau
13
+ - TLmaK0
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2011-05-06 00:00:00 +02:00
18
+ date: 2011-11-21 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies: []
20
21