Class: VertxStomp::StompClientConnection

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb

Overview

Once a connection to the STOMP server has been made, client receives a StompClientConnection, that let send and receive STOMP frames.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 19

def @@j_api_type.accept?(obj)
  obj.class == StompClientConnection
end

+ (Object) j_api_type



28
29
30
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



31
32
33
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 31

def self.j_class
  Java::IoVertxExtStomp::StompClientConnection.java_class
end

+ (Object) unwrap(obj)



25
26
27
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 25

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



22
23
24
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 22

def @@j_api_type.wrap(obj)
  StompClientConnection.new(obj)
end

Instance Method Details

- (self) abort(id = nil, headers = nil) { ... }

Aborts a transaction.

Parameters:

  • id (String) (defaults to: nil)
    the transaction id, must not be null
  • headers (Hash{String => String}) (defaults to: nil)
    additional headers to send to the server. The transaction header is replaced by the value passed in the @id parameter

Yields:

  • the handler invoked when the RECEIPT frame associated with the transaction cancellation has been processed by the server. The handler receives the sent frame (ABORT).

Returns:

  • (self)

Raises:

  • (ArgumentError)


263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 263

def abort(id=nil,headers=nil)
  if id.class == String && !block_given? && headers == nil
    @j_del.java_method(:abort, [Java::java.lang.String.java_class]).call(id)
    return self
  elsif id.class == String && block_given? && headers == nil
    @j_del.java_method(:abort, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif id.class == String && headers.class == Hash && !block_given?
    @j_del.java_method(:abort, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }])
    return self
  elsif id.class == String && headers.class == Hash && block_given?
    @j_del.java_method(:abort, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }],(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling abort(#{id},#{headers})"
end

- (self) ack(id = nil, txId = nil) { ... }

Sends an acknowledgement for the given frame. It means that the frame has been handled and processed by the client. The sent acknowledgement is part of the transaction identified by the given id.

Parameters:

  • id (String) (defaults to: nil)
    the message id of the message to acknowledge
  • txId (String) (defaults to: nil)
    the transaction id

Yields:

  • the handler invoked when the RECEIPT frame associated with the acknowledgment has been processed by the server. The handler receives the sent frame (ACK).

Returns:

  • (self)

Raises:

  • (ArgumentError)


306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 306

def ack(id=nil,txId=nil)
  if id.class == String && !block_given? && txId == nil
    @j_del.java_method(:ack, [Java::java.lang.String.java_class]).call(id)
    return self
  elsif id.class == String && block_given? && txId == nil
    @j_del.java_method(:ack, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif id.class == String && txId.class == String && !block_given?
    @j_del.java_method(:ack, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(id,txId)
    return self
  elsif id.class == String && txId.class == String && block_given?
    @j_del.java_method(:ack, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,txId,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling ack(#{id},#{txId})"
end

- (self) begin_tx(id = nil, headers = nil) { ... }

Begins a transaction.

Parameters:

  • id (String) (defaults to: nil)
    the transaction id, must not be null
  • headers (Hash{String => String}) (defaults to: nil)
    additional headers to send to the server. The transaction header is replaced by the value passed in the @id parameter

Yields:

  • the handler invoked when the RECEIPT frame associated with the transaction begin has been processed by the server. The handler receives the sent frame (BEGIN).

Returns:

  • (self)

Raises:

  • (ArgumentError)


221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 221

def begin_tx(id=nil,headers=nil)
  if id.class == String && !block_given? && headers == nil
    @j_del.java_method(:beginTX, [Java::java.lang.String.java_class]).call(id)
    return self
  elsif id.class == String && block_given? && headers == nil
    @j_del.java_method(:beginTX, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif id.class == String && headers.class == Hash && !block_given?
    @j_del.java_method(:beginTX, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }])
    return self
  elsif id.class == String && headers.class == Hash && block_given?
    @j_del.java_method(:beginTX, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }],(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling begin_tx(#{id},#{headers})"
end

- (void) close

This method returns an undefined value.

Closes the connection without sending the DISCONNECT frame.

Raises:

  • (ArgumentError)


50
51
52
53
54
55
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 50

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (self) close_handler { ... }

Sets a handler notified when the STOMP connection is closed.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


186
187
188
189
190
191
192
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 186

def close_handler
  if block_given?
    @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxStomp::StompClientConnection)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling close_handler()"
end

- (self) commit(id = nil, headers = nil) { ... }

Commits a transaction.

Parameters:

  • id (String) (defaults to: nil)
    the transaction id, must not be null
  • headers (Hash{String => String}) (defaults to: nil)
    additional headers to send to the server. The transaction header is replaced by the value passed in the @id parameter

Yields:

  • the handler invoked when the RECEIPT frame associated with the transaction commit has been processed by the server. The handler receives the sent frame (COMMIT).

Returns:

  • (self)

Raises:

  • (ArgumentError)


242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 242

def commit(id=nil,headers=nil)
  if id.class == String && !block_given? && headers == nil
    @j_del.java_method(:commit, [Java::java.lang.String.java_class]).call(id)
    return self
  elsif id.class == String && block_given? && headers == nil
    @j_del.java_method(:commit, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif id.class == String && headers.class == Hash && !block_given?
    @j_del.java_method(:commit, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }])
    return self
  elsif id.class == String && headers.class == Hash && block_given?
    @j_del.java_method(:commit, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(id,Hash[headers.map { |k,v| [k,v] }],(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling commit(#{id},#{headers})"
end

- (true, false) connected?

Returns whether or not the `CONNECTED` frame has been receive meaning that the Stomp connection is established.

Returns:

  • (true, false)
    true if the connection is established, false otherwise

Raises:

  • (ArgumentError)


384
385
386
387
388
389
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 384

def connected?
  if !block_given?
    return @j_del.java_method(:isConnected, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling connected?()"
end

- (self) connection_dropped_handler { ... }

Sets a handler notified when the server does not respond to a ping request in time. In other words, this handler is invoked when the heartbeat has detected a connection failure with the server. The handler can decide to reconnect to the server.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


198
199
200
201
202
203
204
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 198

def connection_dropped_handler
  if block_given?
    @j_del.java_method(:connectionDroppedHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxStomp::StompClientConnection)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling connection_dropped_handler()"
end

- (self) disconnect(frame = nil) { ... }

Disconnects the client. Unlike the #close method, this method send the DISCONNECT frame to the server. This method lets you customize the DISCONNECT frame.

Parameters:

  • frame (Hash) (defaults to: nil)
    the DISCONNECT frame.

Yields:

  • the handler invoked when the RECEIPT frame associated with the disconnection has been processed by the server. The handler receives the sent frame (DISCONNECT).

Returns:

  • (self)

Raises:

  • (ArgumentError)


284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 284

def disconnect(frame=nil)
  if !block_given? && frame == nil
    @j_del.java_method(:disconnect, []).call()
    return self
  elsif block_given? && frame == nil
    @j_del.java_method(:disconnect, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif frame.class == Hash && !block_given?
    @j_del.java_method(:disconnect, [Java::IoVertxExtStomp::Frame.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)))
    return self
  elsif frame.class == Hash && block_given?
    @j_del.java_method(:disconnect, [Java::IoVertxExtStomp::Frame.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)),(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling disconnect(#{frame})"
end

- (self) error_handler { ... }

Sets a handler notified when an ERROR frame is received by the client. The handler receives the ERROR frame and a reference on the VertxStomp::StompClientConnection.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


176
177
178
179
180
181
182
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 176

def error_handler
  if block_given?
    @j_del.java_method(:errorHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling error_handler()"
end

- (self) exception_handler { ... }

Configures the exception handler notified upon TCP-level errors.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


375
376
377
378
379
380
381
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 375

def exception_handler
  if block_given?
    @j_del.java_method(:exceptionHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling exception_handler()"
end

- (self) nack(id = nil, txId = nil) { ... }

Sends a non-acknowledgement for the given frame. It means that the frame has not been handled by the client. The sent non-acknowledgement is part of the transaction identified by the given id.

Parameters:

  • id (String) (defaults to: nil)
    the message id of the message to acknowledge
  • txId (String) (defaults to: nil)
    the transaction id

Yields:

  • the handler invoked when the RECEIPT frame associated with the non-acknowledgment has been processed by the server. The handler receives the sent frame (NACK).

Returns:

  • (self)

Raises:

  • (ArgumentError)


328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 328

def nack(id=nil,txId=nil)
  if id.class == String && !block_given? && txId == nil
    @j_del.java_method(:nack, [Java::java.lang.String.java_class]).call(id)
    return self
  elsif id.class == String && block_given? && txId == nil
    @j_del.java_method(:nack, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif id.class == String && txId.class == String && !block_given?
    @j_del.java_method(:nack, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(id,txId)
    return self
  elsif id.class == String && txId.class == String && block_given?
    @j_del.java_method(:nack, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(id,txId,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling nack(#{id},#{txId})"
end

- (self) ping_handler { ... }

Sets a handler that let customize the behavior when a ping needs to be sent to the server. Be aware that changing the default behavior may break the compliance with the STOMP specification.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


209
210
211
212
213
214
215
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 209

def ping_handler
  if block_given?
    @j_del.java_method(:pingHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxStomp::StompClientConnection)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling ping_handler()"
end

- (self) received_frame_handler { ... }

Configures a received handler that get 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 by the handler.

Unlike VertxStomp::StompClient#received_frame_handler, the given handler won't receive the CONNECTED frame. If a received frame handler is set on the VertxStomp::StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


351
352
353
354
355
356
357
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 351

def received_frame_handler
  if block_given?
    @j_del.java_method(:receivedFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling received_frame_handler()"
end

- (self) send(frame) - (self) send(headers, body) - (self) send(destination, body) - (self) send(frame, receiptHandler) { ... } - (self) send(headers, body, receiptHandler) { ... } - (self) send(destination, body, receiptHandler) { ... } - (self) send(destination, headers, body) - (self) send(destination, headers, body, receiptHandler) { ... }

Sends a SEND frame to the server to the given destination.

Overloads:

  • - (self) send(frame)

    Parameters:

    • frame (Hash)
      the frame
  • - (self) send(headers, body)

    Parameters:

    • headers (Hash{String => String})
      the headers, must not be null
    • body (::Vertx::Buffer)
      the body, may be null
  • - (self) send(destination, body)

    Parameters:

    • destination (String)
      the destination, must not be null
    • body (::Vertx::Buffer)
      the body, may be null
  • - (self) send(frame, receiptHandler) { ... }

    Parameters:

    • frame (Hash)
      the frame

    Yields:

    • the handler invoked when the RECEIPT frame associated with the sent frame has been received. The handler receives the sent frame.
  • - (self) send(headers, body, receiptHandler) { ... }

    Parameters:

    • headers (Hash{String => String})
      the headers, must not be null
    • body (::Vertx::Buffer)
      the body, may be null

    Yields:

    • the handler invoked when the RECEIPT frame associated with the sent frame has been received. The handler receives the sent frame.
  • - (self) send(destination, body, receiptHandler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null
    • body (::Vertx::Buffer)
      the body, may be null

    Yields:

    • the handler invoked when the RECEIPT frame associated with the sent frame has been received. The handler receives the sent frame.
  • - (self) send(destination, headers, body)

    Parameters:

    • destination (String)
      the destination, must not be null
    • headers (Hash{String => String})
      the header. The destination header is replaced by the value given to the destination parameter
    • body (::Vertx::Buffer)
      the body, may be null
  • - (self) send(destination, headers, body, receiptHandler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null
    • headers (Hash{String => String})
      the header. The destination header is replaced by the value given to the destination parameter
    • body (::Vertx::Buffer)
      the body, may be null

    Yields:

    • the handler invoked when the RECEIPT frame associated with the sent frame has been received. The handler receives the sent frame.

Returns:

  • (self)

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 93

def send(param_1=nil,param_2=nil,param_3=nil)
  if param_1.class == Hash && !block_given? && param_2 == nil && param_3 == nil
    @j_del.java_method(:send, [Java::IoVertxExtStomp::Frame.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(param_1)))
    return self
  elsif param_1.class == Hash && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil
    @j_del.java_method(:send, [Java::JavaUtil::Map.java_class,Java::IoVertxCoreBuffer::Buffer.java_class]).call(Hash[param_1.map { |k,v| [k,v] }],param_2.j_del)
    return self
  elsif param_1.class == String && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil
    @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1,param_2.j_del)
    return self
  elsif param_1.class == Hash && block_given? && param_2 == nil && param_3 == nil
    @j_del.java_method(:send, [Java::IoVertxExtStomp::Frame.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(param_1)),(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif param_1.class == Hash && param_2.class.method_defined?(:j_del) && block_given? && param_3 == nil
    @j_del.java_method(:send, [Java::JavaUtil::Map.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(Hash[param_1.map { |k,v| [k,v] }],param_2.j_del,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif param_1.class == String && param_2.class.method_defined?(:j_del) && block_given? && param_3 == nil
    @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,param_2.j_del,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif param_1.class == String && param_2.class == Hash && param_3.class.method_defined?(:j_del) && !block_given?
    @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCoreBuffer::Buffer.java_class]).call(param_1,Hash[param_2.map { |k,v| [k,v] }],param_3.j_del)
    return self
  elsif param_1.class == String && param_2.class == Hash && param_3.class.method_defined?(:j_del) && block_given?
    @j_del.java_method(:send, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,Hash[param_2.map { |k,v| [k,v] }],param_3.j_del,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling send(#{param_1},#{param_2},#{param_3})"
end

- (String) server

Returns the server name.

Returns:

  • (String)
    the server name.

Raises:

  • (ArgumentError)


57
58
59
60
61
62
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 57

def server
  if !block_given?
    return @j_del.java_method(:server, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling server()"
end

- (String) session

Returns the session id.

Returns:

  • (String)
    the session id.

Raises:

  • (ArgumentError)


35
36
37
38
39
40
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 35

def session
  if !block_given?
    return @j_del.java_method(:session, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling session()"
end

- (String) subscribe(destination, handler) { ... } - (String) subscribe(destination, handler, receiptHandler) { ... } - (String) subscribe(destination, headers, handler) { ... } - (String) subscribe(destination, headers, handler, receiptHandler) { ... }

Subscribes to the given destination.

Overloads:

  • - (String) subscribe(destination, handler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null

    Yields:

    • the handler invoked when a message is received on the given destination. Must not be null.
  • - (String) subscribe(destination, handler, receiptHandler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null
    • handler (Proc)
      the handler invoked when a message is received on the given destination. Must not be null.

    Yields:

    • the handler invoked when the RECEIPT frame associated with the subscription has been received. The handler receives the sent frame (SUBSCRIBE).
  • - (String) subscribe(destination, headers, handler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null.
    • headers (Hash{String => String})
      the headers to configure the subscription. It may contain the ack header to configure the acknowledgment policy. If the given set of headers contains the id header, this value is used as subscription id.

    Yields:

    • the handler invoked when a message is received on the given destination. Must not be null.
  • - (String) subscribe(destination, headers, handler, receiptHandler) { ... }

    Parameters:

    • destination (String)
      the destination, must not be null
    • headers (Hash{String => String})
      the headers to configure the subscription. It may contain the ack header to configure the acknowledgment policy. If the given set of headers contains the id header, this value is used as subscription id.
    • handler (Proc)
      the handler invoked when a message is received on the given destination. Must not be null.

    Yields:

    • the handler invoked when the RECEIPT frame associated with the subscription has been received. The handler receives the sent frame (SUBSCRIBE).

Returns:

  • (String)
    the subscription id, which can either be the destination or the id set in the headers.

Raises:

  • (ArgumentError)


139
140
141
142
143
144
145
146
147
148
149
150
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 139

def subscribe(param_1=nil,param_2=nil,param_3=nil)
  if param_1.class == String && block_given? && param_2 == nil && param_3 == nil
    return @j_del.java_method(:subscribe, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
  elsif param_1.class == String && param_2.class == Proc && block_given? && param_3 == nil
    return @j_del.java_method(:subscribe, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,(Proc.new { |event| param_2.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
  elsif param_1.class == String && param_2.class == Hash && block_given? && param_3 == nil
    return @j_del.java_method(:subscribe, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,Hash[param_2.map { |k,v| [k,v] }],(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
  elsif param_1.class == String && param_2.class == Hash && param_3.class == Proc && block_given?
    return @j_del.java_method(:subscribe, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call(param_1,Hash[param_2.map { |k,v| [k,v] }],(Proc.new { |event| param_3.call(event != nil ? JSON.parse(event.toJson.encode) : nil) }),(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling subscribe(#{param_1},#{param_2},#{param_3})"
end

- (self) unsubscribe(destination = nil, headers = nil) { ... }

Un-subscribes from the given destination. This method computes the subscription id as follows. If the given headers contains the id header, the header value is used. Otherwise the destination is used.

Parameters:

  • destination (String) (defaults to: nil)
    the destination
  • headers (Hash{String => String}) (defaults to: nil)
    the headers

Yields:

  • the handler invoked when the RECEIPT frame associated with the un-subscription has been received. The handler receives the sent frame (UNSUBSCRIBE).

Returns:

  • (self)

Raises:

  • (ArgumentError)


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 157

def unsubscribe(destination=nil,headers=nil)
  if destination.class == String && !block_given? && headers == nil
    @j_del.java_method(:unsubscribe, [Java::java.lang.String.java_class]).call(destination)
    return self
  elsif destination.class == String && block_given? && headers == nil
    @j_del.java_method(:unsubscribe, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(destination,(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  elsif destination.class == String && headers.class == Hash && !block_given?
    @j_del.java_method(:unsubscribe, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(destination,Hash[headers.map { |k,v| [k,v] }])
    return self
  elsif destination.class == String && headers.class == Hash && block_given?
    @j_del.java_method(:unsubscribe, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::IoVertxCore::Handler.java_class]).call(destination,Hash[headers.map { |k,v| [k,v] }],(Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling unsubscribe(#{destination},#{headers})"
end

- (String) version

Returns the STOMP protocol version negotiated with the server.

Returns:

  • (String)
    the STOMP protocol version negotiated with the server.

Raises:

  • (ArgumentError)


42
43
44
45
46
47
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 42

def version
  if !block_given?
    return @j_del.java_method(:version, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling version()"
end

- (self) writing_frame_handler { ... }

Configures a handler notified when a frame is going to be written on the wire. This handler can be used from logging, debugging. The handler can modify the received frame.

If a writing frame handler is set on the VertxStomp::StompClient, it will be used by all clients connection, so calling this method is useless, except if you want to use a different handler.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


365
366
367
368
369
370
371
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/stomp_client_connection.rb', line 365

def writing_frame_handler
  if block_given?
    @j_del.java_method(:writingFrameHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.toJson.encode) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling writing_frame_handler()"
end