Class: VertxStomp::StompServer
- Inherits:
-
Object
- Object
- VertxStomp::StompServer
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb
Overview
Defines a STOMP server. STOMP servers delegates to a StompServerHandler that let customize the behavior of
the server. By default, it uses a handler compliant with the STOMP specification, but let you change anything.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::VertxStomp::StompServer) create(param_1 = nil, param_2 = nil, param_3 = nil)
Creates a StompServer based on the default Stomp Server implementation.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (Fixnum) actual_port
Gets the port on which the server is listening.
-
- (void) close { ... }
Closes the server.
-
- (self) handler(handler = nil)
Configures the StompServerHandler.
-
- (self) listen(port = nil, host = nil) { ... }
Connects the STOMP server to the given port / interface.
-
- (true, false) listening?
Checks whether or not the server is listening.
-
- (Hash) options
The server options.
-
- (::VertxStomp::StompServerHandler) stomp_handler
The StompServerHandler used by this server.
-
- (::Vertx::Vertx) vertx
The instance of vert.x used by the server.
-
- (Proc) web_socket_handler
Gets the able to manage web socket connections.
-
- (self) writing_frame_handler { ... }
Configures the handler that is invoked every time a frame is going to be written to the "wire".
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-stomp/stomp_server.rb', line 23 def @@j_api_type.accept?(obj) obj.class == StompServer end |
+ (::VertxStomp::StompServer) create(vertx) + (::VertxStomp::StompServer) create(vertx, options) + (::VertxStomp::StompServer) create(vertx, netServer) + (::VertxStomp::StompServer) create(vertx, net, options)
Creates a VertxStomp::StompServer based on the default Stomp Server implementation.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 52 def self.create(param_1=nil,param_2=nil,param_3=nil) if param_1.class.method_defined?(:j_del) && !block_given? && param_2 == nil && param_3 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(param_1.j_del),::VertxStomp::StompServer) elsif param_1.class.method_defined?(:j_del) && param_2.class == Hash && !block_given? && param_3 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtStomp::StompServerOptions.java_class]).call(param_1.j_del,Java::IoVertxExtStomp::StompServerOptions.new(::Vertx::Util::Utils.to_json_object(param_2))),::VertxStomp::StompServer) elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreNet::NetServer.java_class]).call(param_1.j_del,param_2.j_del),::VertxStomp::StompServer) elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class == Hash && !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtStomp::StompServer.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCoreNet::NetServer.java_class,Java::IoVertxExtStomp::StompServerOptions.java_class]).call(param_1.j_del,param_2.j_del,Java::IoVertxExtStomp::StompServerOptions.new(::Vertx::Util::Utils.to_json_object(param_3))),::VertxStomp::StompServer) end raise ArgumentError, "Invalid arguments when calling create(#{param_1},#{param_2},#{param_3})" end |
+ (Object) j_api_type
32 33 34 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.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-stomp/stomp_server.rb', line 35 def self.j_class Java::IoVertxExtStomp::StompServer.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-stomp/stomp_server.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-stomp/stomp_server.rb', line 26 def @@j_api_type.wrap(obj) StompServer.new(obj) end |
Instance Method Details
- (Fixnum) actual_port
Gets the port on which the server is listening.
This is useful if you bound the server specifying 0 as port number signifying an ephemeral port.
125 126 127 128 129 130 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 125 def actual_port if !block_given? return @j_del.java_method(:actualPort, []).call() end raise ArgumentError, "Invalid arguments when calling actual_port()" end |
- (void) close { ... }
This method returns an undefined value.
Closes the server.
105 106 107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 105 def close if !block_given? return @j_del.java_method(:close, []).call() elsif block_given? return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) end raise ArgumentError, "Invalid arguments when calling close()" end |
- (self) handler(handler = nil)
Configures the VertxStomp::StompServerHandler. You must calls this method before calling the #listen method.
67 68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 67 def handler(handler=nil) if handler.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:handler, [Java::IoVertxExtStomp::StompServerHandler.java_class]).call(handler.j_del) return self end raise ArgumentError, "Invalid arguments when calling handler(#{handler})" end |
- (self) listen(port = nil, host = nil) { ... }
Connects the STOMP server to the given port / interface. Once the socket it bounds calls the given handler with
the result. The result may be a failure if the socket is already used.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 80 def listen(port=nil,host=nil) if !block_given? && port == nil && host == nil @j_del.java_method(:listen, []).call() return self elsif port.class == Fixnum && !block_given? && host == nil @j_del.java_method(:listen, [Java::int.java_class]).call(port) return self elsif block_given? && port == nil && host == nil @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompServer) : nil) })) return self elsif port.class == Fixnum && host.class == String && !block_given? @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host) return self elsif port.class == Fixnum && block_given? && host == nil @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompServer) : nil) })) return self elsif port.class == Fixnum && host.class == String && block_given? @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,host,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxStomp::StompServer) : nil) })) return self end raise ArgumentError, "Invalid arguments when calling listen(#{port},#{host})" end |
- (true, false) listening?
Checks whether or not the server is listening.
115 116 117 118 119 120 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 115 def listening? if !block_given? return @j_del.java_method(:isListening, []).call() end raise ArgumentError, "Invalid arguments when calling listening?()" end |
- (Hash) options
Returns the server options
132 133 134 135 136 137 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 132 def if !block_given? return @j_del.java_method(:options, []).call() != nil ? JSON.parse(@j_del.java_method(:options, []).call().toJson.encode) : nil end raise ArgumentError, "Invalid arguments when calling options()" end |
- (::VertxStomp::StompServerHandler) stomp_handler
Returns the VertxStomp::StompServerHandler used by this server.
146 147 148 149 150 151 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 146 def stomp_handler if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:stompHandler, []).call(),::VertxStomp::StompServerHandler) end raise ArgumentError, "Invalid arguments when calling stomp_handler()" end |
- (::Vertx::Vertx) vertx
Returns the instance of vert.x used by the server.
139 140 141 142 143 144 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 139 def vertx if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:vertx, []).call(),::Vertx::Vertx) end raise ArgumentError, "Invalid arguments when calling vertx()" end |
- (Proc) web_socket_handler
Gets the able to manage web socket connections. If the web socket bridge is disabled, it returns
null
.
155 156 157 158 159 160 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 155 def web_socket_handler if !block_given? return ::Vertx::Util::Utils.to_handler_proc(@j_del.java_method(:webSocketHandler, []).call()) { |val| val.j_del } end raise ArgumentError, "Invalid arguments when calling web_socket_handler()" end |
- (self) writing_frame_handler { ... }
Configures the handler that is invoked every time a frame is going to be written to the "wire". It lets you log
the frames, but also adapt the frame if needed.
165 166 167 168 169 170 171 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-stomp/stomp_server.rb', line 165 def writing_frame_handler if block_given? @j_del.java_method(:writingFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxStomp::ServerFrame)) })) return self end raise ArgumentError, "Invalid arguments when calling writing_frame_handler()" end |