Class: VertxStomp::StompClientConnection

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/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.

Instance Method Summary (collapse)

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)


238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 238

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)


281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 281

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)


196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 196

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)


36
37
38
39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 36

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)


173
174
175
176
177
178
179
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 173

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)


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 217

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

- (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)


259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 259

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)


163
164
165
166
167
168
169
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 163

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) 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)


303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 303

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)


184
185
186
187
188
189
190
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 184

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) 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)


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 80

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

@return the server name.

Returns:

  • (String)

Raises:

  • (ArgumentError)


44
45
46
47
48
49
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 44

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

- (String) session

@return the session id.

Returns:

  • (String)

Raises:

  • (ArgumentError)


20
21
22
23
24
25
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 20

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)


126
127
128
129
130
131
132
133
134
135
136
137
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 126

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)


144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 144

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

@return the STOMP protocol version negotiated with the server.

Returns:

  • (String)

Raises:

  • (ArgumentError)


28
29
30
31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-stomp/src/main/resources/vertx-stomp/stomp_client_connection.rb', line 28

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