Class: VertxStomp::StompClient
- Inherits:
-
Object
- Object
- VertxStomp::StompClient
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb
Overview
Defines a STOMP client.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxStomp::StompClient) create(*args)
Creates a StompClient using the default implementation.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) close
Closes the client.
-
- (true, false) isClosed
Whether or not the client is connected to the server.
-
- (self) connect(*args)
Connects to the server.
-
- (self) errorFrameHandler(handler) { ... }
A general error frame handler.
-
- (self) exceptionHandler(handler) { ... }
Sets an exception handler notified for TCP-level errors.
-
- (Hash{String => Object}) options
The client's options.
-
- (self) receivedFrameHandler(handler) { ... }
Configures a received handler that gets notified when a STOMP frame is received by the client.
-
- (::Vertx::Vertx) vertx
The vert.x instance used by the client.
-
- (self) writingFrameHandler(handler) { ... }
Configures a writing handler that gets notified when a STOMP frame is written on the wire.
Class Method Details
+ (Boolean) accept?(obj)
21 22 23 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 21 def @@j_api_type.accept?(obj) obj.class == StompClient end |
+ (::VertxStomp::StompClient) create(vertx) + (::VertxStomp::StompClient) create(vertx, options)
Creates a VertxStomp::StompClient using the default implementation.
117 118 119 120 121 122 123 124 125 126 127 128 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 117 def self.create(*args) if args[0].class.method_defined?(:j_del) && !block_given? && args[1] == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(args[0].j_del),::VertxStomp::StompClient) elsif args[0].class.method_defined?(:j_del) && args[1].class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompClient.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtStomp::StompClientOptions.java_class]).call(args[0].j_del,Java::IoVertxExtStomp::StompClientOptions.new(::Vertx::Util::Utils.to_json_object(args[1]))),::VertxStomp::StompClient) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling create(#{args[0]},#{args[1]})" end end |
+ (Object) j_api_type
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 30 def self.j_api_type @@j_api_type end |
+ (Object) j_class
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 33 def self.j_class Java::IoVertxExtStomp::StompClient.java_class end |
+ (Object) unwrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 27 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 24 def @@j_api_type.wrap(obj) StompClient.new(obj) end |
Instance Method Details
- (void) close
This method returns an undefined value.
Closes the client.
149 150 151 152 153 154 155 156 157 158 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 149 def close if !block_given? return @j_del.java_method(:close, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling close()" end end |
- (true, false) isClosed
Returns whether or not the client is connected to the server.
38 39 40 41 42 43 44 45 46 47 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 38 def closed? if !block_given? return @j_del.java_method(:isClosed, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling closed?()" end end |
- (self) connect(resultHandler) { ... } - (self) connect(net, resultHandler) { ... } - (self) connect(port, host, resultHandler) { ... } - (self) connect(port, host, net, resultHandler) { ... }
Connects to the server.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 190 def connect(*args) if true && args[0] == nil && args[1] == nil && args[2] == nil if (block_given?) @j_del.java_method(:connect, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:connect, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxStomp::StompClientConnection.j_api_type) end elsif args[0].class.method_defined?(:j_del) && true && args[1] == nil && args[2] == nil if (block_given?) @j_del.java_method(:connect, [Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:connect, [Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxStomp::StompClientConnection.j_api_type) end elsif args[0].class == Fixnum && args[1].class == String && true && args[2] == nil if (block_given?) @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxStomp::StompClientConnection.j_api_type) end elsif args[0].class == Fixnum && args[1].class == String && args[2].class.method_defined?(:j_del) && true if (block_given?) @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],args[2].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return self else promise = ::Vertx::Util::Utils.promise @j_del.java_method(:connect, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCoreNet::NetClient.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],args[1],args[2].j_del,block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompClientConnection) : nil) } : promise) return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future,::VertxStomp::StompClientConnection.j_api_type) end end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling connect(#{args[0]},#{args[1]},#{args[2]})" end end |
- (self) errorFrameHandler(handler) { ... }
A general error frame handler. It can be used to catch
ERROR
frame emitted during the connection process
(wrong authentication). This error handler will be pass to all VertxStomp::StompClientConnection created from this
client. Obviously, the client can override it when the connection is established.
135 136 137 138 139 140 141 142 143 144 145 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 135 def error_frame_handler if true @j_del.java_method(:errorFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling error_frame_handler()" end end |
- (self) exceptionHandler(handler) { ... }
Sets an exception handler notified for TCP-level errors.
163 164 165 166 167 168 169 170 171 172 173 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 163 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 if defined?(super) super else raise ArgumentError, "Invalid arguments when calling exception_handler()" end end |
- (Hash{String => Object}) options
Returns the client's options.
88 89 90 91 92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 88 def if !block_given? return @j_del.java_method(:options, []).call() != nil ? JSON.parse(@j_del.java_method(:options, []).call().toJson.encode) : nil end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling options()" end end |
- (self) receivedFrameHandler(handler) { ... }
Configures a received handler that gets notified when a STOMP frame is received by the client.
This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.
When a connection is created, the handler is used as VertxStomp::StompClientConnection#received_frame_handler.
56 57 58 59 60 61 62 63 64 65 66 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 56 def received_frame_handler if true @j_del.java_method(:receivedFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling received_frame_handler()" end end |
- (::Vertx::Vertx) vertx
Returns the vert.x instance used by the client.
100 101 102 103 104 105 106 107 108 109 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 100 def vertx if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:vertx, []).call(),::Vertx::Vertx) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling vertx()" end end |
- (self) writingFrameHandler(handler) { ... }
Configures a writing handler that gets notified when a STOMP frame is written on the wire.
This handler can be used for logging, debugging or ad-hoc behavior. The frame can still be modified at the time.
When a connection is created, the handler is used as VertxStomp::StompClientConnection#writing_frame_handler.
75 76 77 78 79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_client.rb', line 75 def writing_frame_handler if true @j_del.java_method(:writingFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) unless !block_given? })) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling writing_frame_handler()" end end |