amqp_notifier 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('amqp_notifier', '0.0.4') do |p|
5
+ Echoe.new('amqp_notifier', '0.0.5') do |p|
6
6
  p.description = "AMQP & Qusion helper class"
7
7
  p.url = "http://nosolopau.com"
8
8
  p.author = "Pau"
@@ -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.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Pau"]
9
- s.date = %q{2011-05-02}
9
+ s.date = %q{2011-05-06}
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
@@ -1,6 +1,6 @@
1
1
  class AmqpNotifier
2
2
  DEFAULT_EXCHANGE = 'labs_tests_1'
3
- DEFAULT_OPTIONS = {:durable => true, :nowait => false, :type => :topic}
3
+ DEFAULT_OPTIONS = {:durable => true, :type => :topic}
4
4
  DEFAULT_PREFIX = ''
5
5
  DEFAULT_QUEUE = 'default'
6
6
  RETRIES = 10
@@ -13,12 +13,13 @@ class AmqpNotifier
13
13
  end
14
14
 
15
15
  def publish(key = '', message = '')
16
- Rails.logger.error("#{key}:")
17
- Rails.logger.error("#{message}")
16
+ $stderr.puts "#{key}:"
17
+ $stderr.puts "#{message}"
18
18
  Qusion.channel.topic(@exchange, @options).publish(message, :key => @key_prefix + key)
19
19
  end
20
20
 
21
21
  def subscribe(key = '', &block)
22
+ $stdout.puts "Subscriction to Exchange: #{@exchange} Queue: #{@queue} Key: #{key}"
22
23
  Qusion.channel.prefetch(1).queue(@queue, :durable => true).bind(Qusion.channel.topic(@exchange, @options), :key => key).subscribe(:ack => true) do |info, message|
23
24
  for i in (0..RETRIES)
24
25
  begin
@@ -26,8 +27,9 @@ class AmqpNotifier
26
27
  info.ack
27
28
  break
28
29
  rescue => e
29
- Rails.logger.error("#{e.inspect}:")
30
- Rails.logger.error("#{e.backtrace}")
30
+ $stderr.puts "Error executing block amqp"
31
+ $stderr.puts "#{e.inspect}:"
32
+ e.backtrace.each {|line| $stderr.puts line}
31
33
  if i == RETRIES
32
34
  AmqpNotifier.new("#{@exchange}_errors").publish(key, message)
33
35
  info.reject(:requeue => false)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pau
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-02 00:00:00 +02:00
17
+ date: 2011-05-06 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20