Class: VertxStomp::StompServer
- Inherits:
-
Object
- Object
- VertxStomp::StompServer
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/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.
Class Method Summary (collapse)
-
+ (::VertxStomp::StompServer) create(param_1 = nil, param_2 = nil, param_3 = nil)
Creates a StompServer based on the default Stomp Server implementation.
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
@return the server options.
-
- (::VertxStomp::StompServerHandler) stomp_handler
@return the StompServerHandler used by this server.
-
- (::Vertx::Vertx) vertx
@return 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
+ (::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.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 36 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 |
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.
109 110 111 112 113 114 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 109 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.
89 90 91 92 93 94 95 96 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 89 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.
51 52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 51 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.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 64 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.
99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 99 def listening? if !block_given? return @j_del.java_method(:isListening, []).call() end raise ArgumentError, "Invalid arguments when calling listening?()" end |
- (Hash) options
@return the server options
117 118 119 120 121 122 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 117 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
@return the VertxStomp::StompServerHandler used by this server.
133 134 135 136 137 138 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 133 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
@return the instance of vert.x used by the server.
125 126 127 128 129 130 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 125 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
.
142 143 144 145 146 147 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 142 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.
152 153 154 155 156 157 158 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_server.rb', line 152 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 |