[DRE-commits] [ruby-stomp] 02/04: Imported 1.2.14

Jonas Genannt jonas at brachium-system.net
Tue Aug 27 12:12:01 UTC 2013


This is an automated email from the git hooks/post-receive script.

hggh-guest pushed a commit to branch master
in repository ruby-stomp.

commit cec476a3810cc7a5db3d0713451b4fae69bac4f3
Author: Jonas Genannt <jonas at brachium-system.net>
Date:   Tue Aug 27 14:09:11 2013 +0200

    Imported 1.2.14
---
 CHANGELOG.rdoc          |   11 +++++-
 README.rdoc             |    3 ++
 examples/ssl_uc2.rb     |    2 +-
 examples/ssl_uc3.rb     |    4 +-
 lib/stomp/connection.rb |    6 ++-
 lib/stomp/version.rb    |    2 +-
 metadata.yml            |   94 ++++++++++++++++++++---------------------------
 spec/connection_spec.rb |    7 ++--
 stomp.gemspec           |    4 +-
 test/test_client.rb     |   28 +++++++++++++-
 10 files changed, 93 insertions(+), 68 deletions(-)

diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc
index e5cd967..b445b97 100644
--- a/CHANGELOG.rdoc
+++ b/CHANGELOG.rdoc
@@ -1,4 +1,13 @@
-== 1.2.12 20130728
+== 1.2.14 20130819
+
+* Version bump (1.2.13 release had Stomp::Version of 1.1.12.)
+* Prevent dup subscription header on re-receive
+
+== 1.2.13 20130817
+
+* Issue #68, Stomp::Client#unreceive max_redeliveries off-by-one error
+
+== 1.2.12 20130811
 
 * Fix infinite loop when max reconn attempts is reached
 * Enhance JRuby support in tests
diff --git a/README.rdoc b/README.rdoc
index c81097f..4270a60 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -12,6 +12,8 @@ An implementation of the Stomp protocol for Ruby. See:
 
 See _CHANGELOG.rdoc_ for details.
 
+* Gem version 1.2.14. Cleanup.
+* Gem version 1.2.13. Stomp::Client#unreceive max_redeliveries fix.
 * Gem version 1.2.12. Miscellaneous issue fixes and cleanup.
 * Gem version 1.2.11. JRuby and AMQ support fixes.
 * Gem version 1.2.10. Support failover from heartbeat threads.
@@ -140,4 +142,5 @@ The following people have contributed to Stomp:
 * Jeremy Gailor
 * JP Hastings-Spital
 * Glenn Roberts
+* Ian Smith
 
diff --git a/examples/ssl_uc2.rb b/examples/ssl_uc2.rb
index 243ee00..23b0213 100644
--- a/examples/ssl_uc2.rb
+++ b/examples/ssl_uc2.rb
@@ -26,7 +26,7 @@ class ExampleSSL2
   def run
     ts_flist = []
 
-    # Change the following to the location of your CA's signed certificate.
+    # Change the following to the location of the server's CA signed certificate.
     ts_flist << "/home/gmallard/sslwork/2013/TestCA.crt"
 
     ssl_opts = Stomp::SSLParams.new(:ts_files => ts_flist.join(","), 
diff --git a/examples/ssl_uc3.rb b/examples/ssl_uc3.rb
index cfb33cb..3f5a767 100644
--- a/examples/ssl_uc3.rb
+++ b/examples/ssl_uc3.rb
@@ -27,8 +27,8 @@ class ExampleSSL3
   # Run example.
   def run
     # Change the following:
-    # * location of your client's signed certificate
-    # * location of tour client's private key.
+    # * location of the client's signed certificate
+    # * location of the client's private key.
     ssl_opts = Stomp::SSLParams.new(
       :key_file => "/home/gmallard/sslwork/2013/client.key", # the client's private key
       :cert_file => "/home/gmallard/sslwork/2013/client.crt", # the client's signed certificate
diff --git a/lib/stomp/connection.rb b/lib/stomp/connection.rb
index c20d978..e20344f 100644
--- a/lib/stomp/connection.rb
+++ b/lib/stomp/connection.rb
@@ -336,12 +336,14 @@ module Stomp
       options = { :dead_letter_queue => "/queue/DLQ", :max_redeliveries => 6 }.merge(options)
       # Lets make sure all keys are symbols
       message.headers = message.headers.symbolize_keys
-
       retry_count = message.headers[:retry_count].to_i || 0
       message.headers[:retry_count] = retry_count + 1
       transaction_id = "transaction-#{message.headers[:'message-id']}-#{retry_count}"
       message_id = message.headers.delete(:'message-id')
 
+      # Prevent duplicate 'subscription' headers on subsequent receives
+      message.headers.delete(:subscription) if message.headers[:subscription]
+
       begin
         self.begin transaction_id
 
@@ -349,7 +351,7 @@ module Stomp
           self.ack(message_id, :transaction => transaction_id)
         end
 
-        if retry_count <= options[:max_redeliveries]
+        if message.headers[:retry_count] <= options[:max_redeliveries]
           self.publish(message.headers[:destination], message.body, 
             message.headers.merge(:transaction => transaction_id))
         else
diff --git a/lib/stomp/version.rb b/lib/stomp/version.rb
index c34105b..11b5a77 100644
--- a/lib/stomp/version.rb
+++ b/lib/stomp/version.rb
@@ -6,7 +6,7 @@ module Stomp
   module Version  #:nodoc: all
     MAJOR = 1
     MINOR = 2
-    PATCH = 12
+    PATCH = 14
     STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
   end
 end
diff --git a/metadata.yml b/metadata.yml
index ff2abbd..1a50f48 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,15 +1,10 @@
---- !ruby/object:Gem::Specification 
+--- !ruby/object:Gem::Specification
 name: stomp
-version: !ruby/object:Gem::Version 
-  hash: 7
-  prerelease: false
-  segments: 
-  - 1
-  - 2
-  - 12
-  version: 1.2.12
+version: !ruby/object:Gem::Version
+  version: 1.2.14
+  prerelease: 
 platform: ruby
-authors: 
+authors:
 - Brian McCallister
 - Marius Mathiesen
 - Thiago Morello
@@ -17,37 +12,36 @@ authors:
 autorequire: 
 bindir: bin
 cert_chain: []
-
-date: 2013-08-11 00:00:00 -04:00
-default_executable: 
-dependencies: 
-- !ruby/object:Gem::Dependency 
+date: 2013-08-19 00:00:00.000000000 Z
+dependencies:
+- !ruby/object:Gem::Dependency
   name: rspec
-  prerelease: false
-  requirement: &id001 !ruby/object:Gem::Requirement 
+  requirement: !ruby/object:Gem::Requirement
     none: false
-    requirements: 
-    - - ">="
-      - !ruby/object:Gem::Version 
-        hash: 5
-        segments: 
-        - 2
-        - 3
-        version: "2.3"
+    requirements:
+    - - ! '>='
+      - !ruby/object:Gem::Version
+        version: '2.3'
   type: :development
-  version_requirements: *id001
-description: Ruby client for the Stomp messaging protocol.  Note that this gem is no longer supported on rubyforge.
-email: 
+  prerelease: false
+  version_requirements: !ruby/object:Gem::Requirement
+    none: false
+    requirements:
+    - - ! '>='
+      - !ruby/object:Gem::Version
+        version: '2.3'
+description: Ruby client for the Stomp messaging protocol.  Note that this gem is
+  no longer supported on rubyforge.
+email:
 - brianm at apache.org
 - marius at stones.com
 - morellon at gmail.com
 - allard.guy.m at gmail.com
-executables: 
+executables:
 - catstomp
 - stompcat
 extensions: []
-
-extra_rdoc_files: 
+extra_rdoc_files:
 - CHANGELOG.rdoc
 - LICENSE
 - README.rdoc
@@ -101,7 +95,7 @@ extra_rdoc_files:
 - test/test_ssl.rb
 - test/test_urlogin.rb
 - test/tlogger.rb
-files: 
+files:
 - CHANGELOG.rdoc
 - LICENSE
 - README.rdoc
@@ -165,39 +159,29 @@ files:
 - test/test_ssl.rb
 - test/test_urlogin.rb
 - test/tlogger.rb
-has_rdoc: true
 homepage: https://github.com/stompgem/stomp
 licenses: []
-
 post_install_message: 
 rdoc_options: []
-
-require_paths: 
+require_paths:
 - lib
-required_ruby_version: !ruby/object:Gem::Requirement 
+required_ruby_version: !ruby/object:Gem::Requirement
   none: false
-  requirements: 
-  - - ">="
-    - !ruby/object:Gem::Version 
-      hash: 3
-      segments: 
-      - 0
-      version: "0"
-required_rubygems_version: !ruby/object:Gem::Requirement 
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+required_rubygems_version: !ruby/object:Gem::Requirement
   none: false
-  requirements: 
-  - - ">="
-    - !ruby/object:Gem::Version 
-      hash: 3
-      segments: 
-      - 0
-      version: "0"
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
 requirements: []
-
 rubyforge_project: 
-rubygems_version: 1.3.7
+rubygems_version: 1.8.25
 signing_key: 
 specification_version: 3
 summary: Ruby client for the Stomp messaging protocol
 test_files: []
-
+has_rdoc: 
diff --git a/spec/connection_spec.rb b/spec/connection_spec.rb
index b471333..1289764 100644
--- a/spec/connection_spec.rb
+++ b/spec/connection_spec.rb
@@ -217,22 +217,23 @@ describe Stomp::Connection do
         @message.headers[:retry_count].should == 5
       end
       
-      it "should not send the message to the dead letter queue as persistent if redeliveries equal max redeliveries" do
+      it "should not send the message to the dead letter queue as persistent if retry_count is less than max redeliveries" do
         max_redeliveries = 5
         dead_letter_queue = "/queue/Dead"
         
-        @message.headers["retry_count"] = max_redeliveries
+        @message.headers["retry_count"] = max_redeliveries - 1
         transaction_id = "transaction-#{@message.headers["message-id"]}-#{@message.headers["retry_count"]}"
         @retry_headers = @retry_headers.merge :transaction => transaction_id, :retry_count => @message.headers["retry_count"] + 1
         @connection.should_receive(:publish).with(@message.headers["destination"], @message.body, @retry_headers)
         @connection.unreceive @message, :dead_letter_queue => dead_letter_queue, :max_redeliveries => max_redeliveries
       end
       
+      # If the retry_count has reached max_redeliveries, then we're done.
       it "should send the message to the dead letter queue as persistent if max redeliveries have been reached" do
         max_redeliveries = 5
         dead_letter_queue = "/queue/Dead"
         
-        @message.headers["retry_count"] = max_redeliveries + 1
+        @message.headers["retry_count"] = max_redeliveries
         transaction_id = "transaction-#{@message.headers["message-id"]}-#{@message.headers["retry_count"]}"
         @retry_headers = @retry_headers.merge :persistent => true, :transaction => transaction_id, :retry_count => @message.headers["retry_count"] + 1, :original_destination=> @message.headers["destination"]
         @connection.should_receive(:publish).with(dead_letter_queue, @message.body, @retry_headers)
diff --git a/stomp.gemspec b/stomp.gemspec
index 3e1b001..17111fd 100644
--- a/stomp.gemspec
+++ b/stomp.gemspec
@@ -5,11 +5,11 @@
 
 Gem::Specification.new do |s|
   s.name = %q{stomp}
-  s.version = "1.2.12"
+  s.version = "1.2.14"
 
   s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
   s.authors = ["Brian McCallister", "Marius Mathiesen", "Thiago Morello", "Guy M. Allard"]
-  s.date = %q{2013-08-11}
+  s.date = %q{2013-08-19}
   s.description = %q{Ruby client for the Stomp messaging protocol.  Note that this gem is no longer supported on rubyforge.}
   s.email = ["brianm at apache.org", "marius at stones.com", "morellon at gmail.com", "allard.guy.m at gmail.com"]
   s.executables = ["catstomp", "stompcat"]
diff --git a/test/test_client.rb b/test/test_client.rb
index ed97dae..756fbdf 100644
--- a/test/test_client.rb
+++ b/test/test_client.rb
@@ -443,7 +443,7 @@ class TestClient < Test::Unit::TestCase
 
   # Test that a connection frame is received.
   def test_connection_frame
-  	assert_not_nil @client.connection_frame
+    assert_not_nil @client.connection_frame
     checkEmsg(@client)
   end unless RUBY_ENGINE =~ /jruby/
 
@@ -614,6 +614,32 @@ class TestClient < Test::Unit::TestCase
     end
   end
 
+  # test max redeliveries is not broken (6c2c1c1)
+  def test_max_redeliveries
+    @client.close
+    rdmsg = "To Be Redelivered"
+    dest = make_destination
+    [1, 2, 3].each do |max_re|
+      @client = get_client()
+      sid = @client.uuid()
+      received = nil
+      rm_actual = 0
+      sh = @client.protocol() == Stomp::SPL_10 ?  {} : {:id => sid}
+      @client.subscribe(dest, sh) {|msg|
+        rm_actual += 1
+        @client.unreceive(msg, :max_redeliveries => max_re)
+        received = msg if rm_actual - 1 == max_re
+      }
+      @client.publish(dest, rdmsg)
+      sleep 0.01 until received
+      assert_equal rdmsg, received.body
+      sleep 0.5
+      @client.unsubscribe dest, sh
+      assert_equal max_re, rm_actual - 1
+      @client.close
+    end
+  end
+
   private
     def message_text
       name = caller_method_name unless name

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-stomp.git



More information about the Pkg-ruby-extras-commits mailing list