hot_bunnies 2.0.0.pre3-java → 2.0.0.pre4-java
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.
- data/lib/hot_bunnies.rb +1 -0
- data/lib/hot_bunnies/exceptions.rb +7 -11
- data/lib/hot_bunnies/queue.rb +20 -5
- data/lib/hot_bunnies/session.rb +3 -0
- data/lib/hot_bunnies/version.rb +1 -1
- metadata +4 -3
    
        data/lib/hot_bunnies.rb
    CHANGED
    
    
| @@ -1,8 +1,7 @@ | |
| 1 1 | 
             
            module HotBunnies
         | 
| 2 | 
            -
              class Exception <  | 
| 2 | 
            +
              class Exception < StandardError
         | 
| 3 3 | 
             
              end
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 6 5 | 
             
              class ChannelLevelException < Exception
         | 
| 7 6 | 
             
                attr_reader :channel_close
         | 
| 8 7 |  | 
| @@ -23,13 +22,9 @@ module HotBunnies | |
| 23 22 | 
             
                end
         | 
| 24 23 | 
             
              end
         | 
| 25 24 |  | 
| 26 | 
            -
             | 
| 25 | 
            +
              # Raised when RabbitMQ closes network connection before
         | 
| 26 | 
            +
              # finalizing the connection, typically indicating authentication failure.
         | 
| 27 27 | 
             
              class PossibleAuthenticationFailureError < Exception
         | 
| 28 | 
            -
             | 
| 29 | 
            -
                #
         | 
| 30 | 
            -
                # API
         | 
| 31 | 
            -
                #
         | 
| 32 | 
            -
             | 
| 33 28 | 
             
                attr_reader :username, :vhost
         | 
| 34 29 |  | 
| 35 30 | 
             
                def initialize(username, vhost, password_length)
         | 
| @@ -37,8 +32,8 @@ module HotBunnies | |
| 37 32 | 
             
                  @vhost    = vhost
         | 
| 38 33 |  | 
| 39 34 | 
             
                  super("RabbitMQ closed TCP connection before authentication succeeded: this usually means authentication failure due to misconfiguration or that RabbitMQ version does not support AMQP 0.9.1. Please check your configuration. Username: #{username}, vhost: #{vhost}, password length: #{password_length}")
         | 
| 40 | 
            -
                end | 
| 41 | 
            -
              end | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
              end
         | 
| 42 37 |  | 
| 43 38 |  | 
| 44 39 | 
             
              class PreconditionFailed < ChannelLevelException
         | 
| @@ -68,6 +63,7 @@ module HotBunnies | |
| 68 63 |  | 
| 69 64 |  | 
| 70 65 | 
             
              # Converts RabbitMQ Java client exceptions
         | 
| 66 | 
            +
              #
         | 
| 71 67 | 
             
              # @private
         | 
| 72 68 | 
             
              class Exceptions
         | 
| 73 69 | 
             
                def self.convert(e, unwrap_io_exception = true)
         | 
| @@ -147,5 +143,5 @@ module HotBunnies | |
| 147 143 |  | 
| 148 144 | 
             
                  klass.new(m.reply_text, m)
         | 
| 149 145 | 
             
                end
         | 
| 150 | 
            -
              end | 
| 146 | 
            +
              end
         | 
| 151 147 | 
             
            end # HotBunnies
         | 
    
        data/lib/hot_bunnies/queue.rb
    CHANGED
    
    | @@ -47,13 +47,28 @@ module HotBunnies | |
| 47 47 | 
             
                end
         | 
| 48 48 | 
             
                alias pop get
         | 
| 49 49 |  | 
| 50 | 
            +
                def build_consumer(opts, &block)
         | 
| 51 | 
            +
                  if opts[:block] || opts[:blocking]
         | 
| 52 | 
            +
                    BlockingCallbackConsumer.new(@channel, opts[:buffer_size], opts, block)
         | 
| 53 | 
            +
                  else
         | 
| 54 | 
            +
                    AsyncCallbackConsumer.new(@channel, opts, block, opts.fetch(:executor, JavaConcurrent::Executors.new_single_thread_executor))
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 50 58 | 
             
                def subscribe(opts = {}, &block)
         | 
| 51 | 
            -
                  consumer =  | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 59 | 
            +
                  consumer = build_consumer(opts, &block)
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  @consumer_tag     = @channel.basic_consume(@name, !(opts[:ack] || opts[:manual_ack]), consumer)
         | 
| 62 | 
            +
                  consumer.consumer_tag = @consumer_tag
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  @default_consumer = consumer
         | 
| 65 | 
            +
                  @channel.register_consumer(@consumer_tag, consumer)
         | 
| 66 | 
            +
                  consumer.start
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                  consumer
         | 
| 69 | 
            +
                end
         | 
| 56 70 |  | 
| 71 | 
            +
                def subscribe_with(consumer, opts = {})
         | 
| 57 72 | 
             
                  @consumer_tag     = @channel.basic_consume(@name, !(opts[:ack] || opts[:manual_ack]), consumer)
         | 
| 58 73 | 
             
                  consumer.consumer_tag = @consumer_tag
         | 
| 59 74 |  | 
    
        data/lib/hot_bunnies/session.rb
    CHANGED
    
    
    
        data/lib/hot_bunnies/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hot_bunnies
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0.0. | 
| 4 | 
            +
              version: 2.0.0.pre4
         | 
| 5 5 | 
             
              prerelease: 6
         | 
| 6 6 | 
             
            platform: java
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -10,7 +10,7 @@ authors: | |
| 10 10 | 
             
            autorequire:
         | 
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 | 
            -
            date: 2013- | 
| 13 | 
            +
            date: 2013-06-28 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies: []
         | 
| 15 15 | 
             
            description: RabbitMQ client for JRuby built around the official RabbitMQ Java client
         | 
| 16 16 | 
             
            email:
         | 
| @@ -31,7 +31,7 @@ files: | |
| 31 31 | 
             
            - lib/hot_bunnies/queue.rb
         | 
| 32 32 | 
             
            - lib/hot_bunnies/session.rb
         | 
| 33 33 | 
             
            - lib/hot_bunnies/version.rb
         | 
| 34 | 
            -
            homepage: http:// | 
| 34 | 
            +
            homepage: http://hotbunnies.info
         | 
| 35 35 | 
             
            licenses: []
         | 
| 36 36 | 
             
            post_install_message:
         | 
| 37 37 | 
             
            rdoc_options: []
         | 
| @@ -56,3 +56,4 @@ signing_key: | |
| 56 56 | 
             
            specification_version: 3
         | 
| 57 57 | 
             
            summary: RabbitMQ client for JRuby built around the official RabbitMQ Java client
         | 
| 58 58 | 
             
            test_files: []
         | 
| 59 | 
            +
            has_rdoc:
         |