Class: Vertx::Message
- Inherits:
-
Object
- Object
- Vertx::Message
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb
Overview
Represents a message that is received from the event bus in a handler.
Messages have a #body, which can be null, and also #headers, which can be empty.
If the message was sent specifying a reply handler, it can be replied to using #reply.
If you want to notify the sender that processing failed, then #fail can be called.
Instance Method Summary (collapse)
-
- (String) address
The address the message was sent to.
-
- (Object) body
The body of the message.
-
- (void) fail(failureCode = nil, message = nil)
Signal to the sender that processing of this message failed.
-
- (::Vertx::MultiMap) headers
Multi-map of message headers.
-
- (void) reply(message = nil, options = nil) { ... }
The same as reply(R message, DeliveryOptions) but you can specify handler for the reply - i.e.
-
- (String) reply_address
The reply address.
-
- (true, false) send?
Signals if this message represents a send or publish event.
Instance Method Details
- (String) address
The address the message was sent to
26 27 28 29 30 31 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 26 def address if !block_given? return @j_del.java_method(:address, []).call() end raise ArgumentError, "Invalid arguments when calling address()" end |
- (Object) body
The body of the message. Can be null.
42 43 44 45 46 47 48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 42 def body if !block_given? if @cached_body != nil return @cached_body end return @cached_body = @j_arg_T.wrap(@j_del.java_method(:body, []).call()) end raise ArgumentError, "Invalid arguments when calling body()" end |
- (void) fail(failureCode = nil, message = nil)
This method returns an undefined value.
Signal to the sender that processing of this message failed.If the message was sent specifying a result handler the handler will be called with a failure corresponding to the failure code and message specified here.
92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 92 def fail(failureCode=nil,=nil) if failureCode.class == Fixnum && .class == String && !block_given? return @j_del.java_method(:fail, [Java::int.java_class,Java::java.lang.String.java_class]).call(failureCode,) end raise ArgumentError, "Invalid arguments when calling fail(#{failureCode},#{})" end |
- (::Vertx::MultiMap) headers
Multi-map of message headers. Can be empty
34 35 36 37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 34 def headers if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:headers, []).call(),::Vertx::MultiMap) end raise ArgumentError, "Invalid arguments when calling headers()" end |
- (void) reply(message = nil, options = nil) { ... }
This method returns an undefined value.
The same asreply(R message, DeliveryOptions)
but you can specify handler for the reply - i.e.
to receive the reply to the reply.
73 74 75 76 77 78 79 80 81 82 83 84 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 73 def reply(=nil,=nil) if ::Vertx::Util::unknown_type.accept?() && !block_given? && == nil return @j_del.java_method(:reply, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object()) elsif ::Vertx::Util::unknown_type.accept?() && block_given? && == nil return @j_del.java_method(:reply, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Message, nil) : nil) })) elsif ::Vertx::Util::unknown_type.accept?() && .class == Hash && !block_given? return @j_del.java_method(:reply, [Java::java.lang.Object.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(::Vertx::Util::Utils.to_object(),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object())) elsif ::Vertx::Util::unknown_type.accept?() && .class == Hash && block_given? return @j_del.java_method(:reply, [Java::java.lang.Object.java_class,Java::IoVertxCoreEventbus::DeliveryOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(),Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object()),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Message, nil) : nil) })) end raise ArgumentError, "Invalid arguments when calling reply(#{},#{})" end |
- (String) reply_address
The reply address. Can be null.
53 54 55 56 57 58 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 53 def reply_address if !block_given? return @j_del.java_method(:replyAddress, []).call() end raise ArgumentError, "Invalid arguments when calling reply_address()" end |
- (true, false) send?
Signals if this message represents a send or publish event.
61 62 63 64 65 66 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/message.rb', line 61 def send? if !block_given? return @j_del.java_method(:isSend, []).call() end raise ArgumentError, "Invalid arguments when calling send?()" end |