Class: VertxRabbitmq::RabbitMQConsumer
- Inherits:
-
Object
- Object
- VertxRabbitmq::RabbitMQConsumer
- Includes:
- Vertx::ReadStream
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb
Overview
A stream of messages from a rabbitmq queue.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) cancel { ... }
Stop message consumption from a queue.
-
- (String) consumer_tag
A consumer tag.
-
- (self) end_handler { ... }
Set an end handler.
-
- (self) exception_handler { ... }
Set an exception handler on the read stream.
-
- (self) fetch(amount = nil)
Fetch the specified amount of elements.
-
- (self) handler { ... }
Set a message handler.
-
- (self) pause
Pause the stream of incoming messages from queue.
-
- (true, false) paused?
Is the stream paused?.
-
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
-
- (void) pipe_to(dst = nil) { ... }
Pipe this ReadStream to the WriteStream.
-
- (self) resume
Resume reading from a queue.
Class Method Details
+ (Boolean) accept?(obj)
23 24 25 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 23 def @@j_api_type.accept?(obj) obj.class == RabbitMQConsumer end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 32 def self.j_api_type @@j_api_type end |
+ (Object) j_class
35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 35 def self.j_class Java::IoVertxRabbitmq::RabbitMQConsumer.java_class end |
+ (Object) unwrap(obj)
29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 29 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 26 def @@j_api_type.wrap(obj) RabbitMQConsumer.new(obj) end |
Instance Method Details
- (void) cancel { ... }
This method returns an undefined value.
Stop message consumption from a queue.The operation is asynchronous. When consumption will be stopped, you can by notified via #end_handler
138 139 140 141 142 143 144 145 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 138 def cancel if !block_given? return @j_del.java_method(:cancel, []).call() elsif true return @j_del.java_method(:cancel, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?)) end raise ArgumentError, "Invalid arguments when calling cancel()" end |
- (String) consumer_tag
Returns a consumer tag
127 128 129 130 131 132 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 127 def consumer_tag if !block_given? return @j_del.java_method(:consumerTag, []).call() end raise ArgumentError, "Invalid arguments when calling consumer_tag()" end |
- (self) end_handler { ... }
Set an end handler. Once the stream has canceled successfully, the handler will be called.
119 120 121 122 123 124 125 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 119 def end_handler if true @j_del.java_method(:endHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield unless !block_given? }) return self end raise ArgumentError, "Invalid arguments when calling end_handler()" end |
- (self) exception_handler { ... }
Set an exception handler on the read stream.
78 79 80 81 82 83 84 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 78 def exception_handler if true @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling exception_handler()" end |
- (self) fetch(amount = nil)
Fetch the specified
amount of elements. If the ReadStream has been paused, reading will
recommence with the specified amount of items, otherwise the specified amount will
be added to the current stream demand.
43 44 45 46 47 48 49 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 43 def fetch(amount=nil) if amount.class == Fixnum && !block_given? @j_del.java_method(:fetch, [Java::long.java_class]).call(amount) return self end raise ArgumentError, "Invalid arguments when calling fetch(#{amount})" end |
- (self) handler { ... }
Set a message handler. As message appear in a queue, the handler will be called with the message.
88 89 90 91 92 93 94 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 88 def handler if true @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxRabbitmq::RabbitMQMessage)) unless !block_given? })) return self end raise ArgumentError, "Invalid arguments when calling handler()" end |
- (self) pause
Pause the stream of incoming messages from queue.
The messages will continue to arrive, but they will be stored in a internal queue. If the queue size would exceed the limit provided by , then incoming messages will be discarded.
100 101 102 103 104 105 106 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 100 def pause if !block_given? @j_del.java_method(:pause, []).call() return self end raise ArgumentError, "Invalid arguments when calling pause()" end |
- (true, false) paused?
Returns is the stream paused?
147 148 149 150 151 152 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 147 def paused? if !block_given? return @j_del.java_method(:isPaused, []).call() end raise ArgumentError, "Invalid arguments when calling paused?()" end |
- (::Vertx::Pipe) pipe
Pause this stream and return a to transfer the elements of this stream to a destination .
The stream will be resumed when the pipe will be wired to a
WriteStream.
54 55 56 57 58 59 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 54 def pipe if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:pipe, []).call(),::Vertx::Pipe,::VertxRabbitmq::RabbitMQMessage.j_api_type) end raise ArgumentError, "Invalid arguments when calling pipe()" end |
- (void) pipe_to(dst = nil) { ... }
This method returns an undefined value.
Pipe thisReadStream to the WriteStream.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler will be
called with the result.
69 70 71 72 73 74 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 69 def pipe_to(dst=nil) if dst.class.method_defined?(:j_del) && true return @j_del.java_method(:pipeTo, [Java::IoVertxCoreStreams::WriteStream.java_class,Java::IoVertxCore::Handler.java_class]).call(dst.j_del,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?)) end raise ArgumentError, "Invalid arguments when calling pipe_to(#{dst})" end |
- (self) resume
Resume reading from a queue. Flushes internal queue.
109 110 111 112 113 114 115 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-rabbitmq/rabbit_mq_consumer.rb', line 109 def resume if !block_given? @j_del.java_method(:resume, []).call() return self end raise ArgumentError, "Invalid arguments when calling resume()" end |