Class: VertxTcpEventbusBridge::BridgeEvent
- Inherits:
-
VertxBridgeCommon::BaseBridgeEvent
- Object
- Vertx::Promise
- VertxBridgeCommon::BaseBridgeEvent
- VertxTcpEventbusBridge::BridgeEvent
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb
Overview
Represents an event that occurs on the event bus bridge.
Please consult the documentation for a full explanation.
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) complete(result = nil)
Set the result.
-
- (void) fail(param_1 = nil)
Calls Vertx::Promise#fail with the message.
-
- (::Vertx::Future) future
The associated with this promise, it can be used to be aware of the promise completion.
-
- (Hash{String => Object}) get_raw_message
Get the raw JSON message for the event.
-
- (self) set_raw_message(message = nil)
Get the raw JSON message for the event.
-
- (::Vertx::NetSocket) socket
Get the SockJSSocket instance corresponding to the event.
-
- (true, false) try_complete?(result = nil)
Like Vertx::Promise#complete but returns false when the promise is already completed instead of throwing an IllegalStateException, it returns true otherwise.
-
- (true, false) try_fail?(param_1 = nil)
Calls Vertx::Promise#fail with the message.
-
- (:SOCKET_CREATED, ...) type
The type of the event.
Methods inherited from Vertx::Promise
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-tcp-eventbus-bridge/bridge_event.rb', line 23 def @@j_api_type.accept?(obj) obj.class == BridgeEvent end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.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-tcp-eventbus-bridge/bridge_event.rb', line 35 def self.j_class Java::IoVertxExtEventbusBridgeTcp::BridgeEvent.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-tcp-eventbus-bridge/bridge_event.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-tcp-eventbus-bridge/bridge_event.rb', line 26 def @@j_api_type.wrap(obj) BridgeEvent.new(obj) end |
Instance Method Details
- (void) complete(result = nil)
This method returns an undefined value.
Set the result. Any handler will be called, if there is one, and the promise will be marked as completed. Any handler set on the associated promise will be called.
43 44 45 46 47 48 49 50 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 43 def complete(result=nil) if !block_given? && result == nil return @j_del.java_method(:complete, []).call() elsif (result.class == TrueClass || result.class == FalseClass) && !block_given? return @j_del.java_method(:complete, [Java::JavaLang::Boolean.java_class]).call(result) end raise ArgumentError, "Invalid arguments when calling complete(#{result})" end |
- (void) fail(cause) - (void) fail(message)
57 58 59 60 61 62 63 64 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 57 def fail(param_1=nil) if param_1.is_a?(Exception) && !block_given? return @j_del.java_method(:fail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1)) elsif param_1.class == String && !block_given? return @j_del.java_method(:fail, [Java::java.lang.String.java_class]).call(param_1) end raise ArgumentError, "Invalid arguments when calling fail(#{param_1})" end |
- (::Vertx::Future) future
Returns the associated with this promise, it can be used to be aware of the promise completion
92 93 94 95 96 97 98 99 100 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 92 def future if !block_given? if @cached_future != nil return @cached_future end return @cached_future = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:future, []).call(),::Vertx::Future, nil) end raise ArgumentError, "Invalid arguments when calling future()" end |
- (Hash{String => Object}) get_raw_message
Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is
no message involved. If the returned message is modified, #set_raw_message should be called with the
new message.
115 116 117 118 119 120 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 115 def if !block_given? return @j_del.java_method(:getRawMessage, []).call() != nil ? JSON.parse(@j_del.java_method(:getRawMessage, []).call().encode) : nil end raise ArgumentError, "Invalid arguments when calling get_raw_message()" end |
- (self) set_raw_message(message = nil)
Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is
no message involved.
125 126 127 128 129 130 131 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 125 def (=nil) if .class == Hash && !block_given? @j_del.java_method(:setRawMessage, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object()) return self end raise ArgumentError, "Invalid arguments when calling set_raw_message(#{})" end |
- (::Vertx::NetSocket) socket
Get the SockJSSocket instance corresponding to the event
134 135 136 137 138 139 140 141 142 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 134 def socket if !block_given? if @cached_socket != nil return @cached_socket end return @cached_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socket, []).call(),::Vertx::NetSocket) end raise ArgumentError, "Invalid arguments when calling socket()" end |
- (true, false) try_complete?(result = nil)
Like Vertx::Promise#complete but returns
false
when the promise is already completed instead of throwing
an IllegalStateException, it returns true
otherwise.
69 70 71 72 73 74 75 76 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 69 def try_complete?(result=nil) if !block_given? && result == nil return @j_del.java_method(:tryComplete, []).call() elsif (result.class == TrueClass || result.class == FalseClass) && !block_given? return @j_del.java_method(:tryComplete, [Java::JavaLang::Boolean.java_class]).call(result) end raise ArgumentError, "Invalid arguments when calling try_complete?(#{result})" end |
- (true, false) tryFail(cause) - (true, false) tryFail(message)
Calls Vertx::Promise#fail with the
message
.
83 84 85 86 87 88 89 90 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 83 def try_fail?(param_1=nil) if param_1.is_a?(Exception) && !block_given? return @j_del.java_method(:tryFail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1)) elsif param_1.class == String && !block_given? return @j_del.java_method(:tryFail, [Java::java.lang.String.java_class]).call(param_1) end raise ArgumentError, "Invalid arguments when calling try_fail?(#{param_1})" end |
- (:SOCKET_CREATED, ...) type
Returns the type of the event
102 103 104 105 106 107 108 109 110 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-tcp-eventbus-bridge/bridge_event.rb', line 102 def type if !block_given? if @cached_type != nil return @cached_type end return @cached_type = @j_del.java_method(:type, []).call().name.intern end raise ArgumentError, "Invalid arguments when calling type()" end |