Class: VertxMqtt::MqttEndpoint

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb

Overview

Represents an MQTT endpoint for point-to-point communication with the remote MQTT client

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 22

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

+ (Object) j_api_type



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 31

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 34

def self.j_class
  Java::IoVertxMqtt::MqttEndpoint.java_class
end

+ (Object) unwrap(obj)



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 28

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

+ (Object) wrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 25

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

Instance Method Details

- (self) accept(sessionPresent = nil)

Sends the CONNACK message to the remote MQTT client with "connection accepted" return code. See #reject for refusing connection

Parameters:

  • sessionPresent (true, false) (defaults to: nil)
    if a previous session is present

Returns:

  • (self)

Raises:

  • (ArgumentError)


343
344
345
346
347
348
349
350
351
352
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 343

def accept(sessionPresent=nil)
  if !block_given? && sessionPresent == nil
    @j_del.java_method(:accept, []).call()
    return self
  elsif (sessionPresent.class == TrueClass || sessionPresent.class == FalseClass) && !block_given?
    @j_del.java_method(:accept, [Java::boolean.java_class]).call(sessionPresent)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling accept(#{sessionPresent})"
end

- (Hash) auth

Returns the Authentication information as provided by the remote MQTT client

Returns:

  • (Hash)
    the Authentication information as provided by the remote MQTT client

Raises:

  • (ArgumentError)


83
84
85
86
87
88
89
90
91
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 83

def auth
  if !block_given?
    if @cached_auth != nil
      return @cached_auth
    end
    return @cached_auth = @j_del.java_method(:auth, []).call() != nil ? JSON.parse(@j_del.java_method(:auth, []).call().toJson.encode) : nil
  end
  raise ArgumentError, "Invalid arguments when calling auth()"
end

- (self) auto_keep_alive(isAutoKeepAlive = nil)

Enable/disable auto keep alive (sending ping response)

Parameters:

  • isAutoKeepAlive (true, false) (defaults to: nil)
    auto keep alive

Returns:

  • (self)

Raises:

  • (ArgumentError)


188
189
190
191
192
193
194
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 188

def auto_keep_alive(isAutoKeepAlive=nil)
  if (isAutoKeepAlive.class == TrueClass || isAutoKeepAlive.class == FalseClass) && !block_given?
    @j_del.java_method(:autoKeepAlive, [Java::boolean.java_class]).call(isAutoKeepAlive)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling auto_keep_alive(#{isAutoKeepAlive})"
end

- (true, false) auto_keep_alive?

Returns the auto keep alive status (sending ping response)

Returns:

  • (true, false)
    the auto keep alive status (sending ping response)

Raises:

  • (ArgumentError)


196
197
198
199
200
201
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 196

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

- (true, false) clean_session?

Returns true when clean session is requested by the remote MQTT client

Returns:

  • (true, false)
    true when clean session is requested by the remote MQTT client

Raises:

  • (ArgumentError)


123
124
125
126
127
128
129
130
131
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 123

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

- (String) client_identifier

Returns the client identifier as provided by the remote MQTT client

Returns:

  • (String)
    the client identifier as provided by the remote MQTT client

Raises:

  • (ArgumentError)


73
74
75
76
77
78
79
80
81
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 73

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

- (void) close

This method returns an undefined value.

Close the endpoint, so the connection with remote MQTT client

Raises:

  • (ArgumentError)


39
40
41
42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 39

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

- (self) close_handler { ... }

Set a close handler. This will be called when the MQTT endpoint is closed

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


322
323
324
325
326
327
328
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 322

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

- (true, false) connected?

Returns if the connection between remote client and local endpoint is established/open

Returns:

  • (true, false)
    if the connection between remote client and local endpoint is established/open

Raises:

  • (ArgumentError)


203
204
205
206
207
208
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 203

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

- (self) disconnect_handler { ... }

Set a disconnect handler on the MQTT endpoint. This handler is called when a DISCONNECT message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


223
224
225
226
227
228
229
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 223

def disconnect_handler
  if block_given?
    @j_del.java_method(:disconnectHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling disconnect_handler()"
end

- (self) exception_handler { ... }

Set an exception handler. This will be called when an error at protocol level happens

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


332
333
334
335
336
337
338
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 332

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

- (Fixnum) keep_alive_time_seconds

Returns the keep alive timeout (in seconds) specified by the remote MQTT client

Returns:

  • (Fixnum)
    the keep alive timeout (in seconds) specified by the remote MQTT client

Raises:

  • (ArgumentError)


133
134
135
136
137
138
139
140
141
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 133

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

- (Fixnum) last_message_id

Returns the message identifier used for last published message

Returns:

  • (Fixnum)
    the message identifier used for last published message

Raises:

  • (ArgumentError)


143
144
145
146
147
148
149
150
151
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 143

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

- (::Vertx::SocketAddress) local_address

Returns the local address for this socket

Returns:

Raises:

  • (ArgumentError)


56
57
58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 56

def local_address
  if !block_given?
    if @cached_local_address != nil
      return @cached_local_address
    end
    return @cached_local_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:localAddress, []).call(),::Vertx::SocketAddress)
  end
  raise ArgumentError, "Invalid arguments when calling local_address()"
end

- (self) ping_handler { ... }

Set the pingreq handler on the MQTT endpoint. This handler is called when a PINGREQ message is received by the remote MQTT client. In any case the endpoint sends the PINGRESP internally after executing this handler.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


312
313
314
315
316
317
318
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 312

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

- (self) pong

Sends the PINGRESP message to the remote MQTT client

Returns:

  • (self)

Raises:

  • (ArgumentError)


445
446
447
448
449
450
451
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 445

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

- (String) protocol_name

Returns the protocol name provided by the remote MQTT client

Returns:

  • (String)
    the protocol name provided by the remote MQTT client

Raises:

  • (ArgumentError)


113
114
115
116
117
118
119
120
121
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 113

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

- (Fixnum) protocol_version

Returns the protocol version required by the remote MQTT client

Returns:

  • (Fixnum)
    the protocol version required by the remote MQTT client

Raises:

  • (ArgumentError)


103
104
105
106
107
108
109
110
111
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 103

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

- (self) publish(topic = nil, payload = nil, qosLevel = nil, isDup = nil, isRetain = nil) { ... }

Sends the PUBLISH message to the remote MQTT server

Parameters:

  • topic (String) (defaults to: nil)
    topic on which the message is published
  • payload (::Vertx::Buffer) (defaults to: nil)
    message payload
  • qosLevel (:AT_MOST_ONCE, :AT_LEAST_ONCE, :EXACTLY_ONCE, :FAILURE) (defaults to: nil)
    QoS level
  • isDup (true, false) (defaults to: nil)
    if the message is a duplicate
  • isRetain (true, false) (defaults to: nil)
    if the message needs to be retained

Yields:

  • handler called after PUBLISH packet sent with a packetId

Returns:

  • (self)

Raises:

  • (ArgumentError)


433
434
435
436
437
438
439
440
441
442
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 433

def publish(topic=nil,payload=nil,qosLevel=nil,isDup=nil,isRetain=nil)
  if topic.class == String && payload.class.method_defined?(:j_del) && qosLevel.class == Symbol && (isDup.class == TrueClass || isDup.class == FalseClass) && (isRetain.class == TrueClass || isRetain.class == FalseClass) && !block_given?
    @j_del.java_method(:publish, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoNettyHandlerCodecMqtt::MqttQoS.java_class,Java::boolean.java_class,Java::boolean.java_class]).call(topic,payload.j_del,Java::IoNettyHandlerCodecMqtt::MqttQoS.valueOf(qosLevel.to_s),isDup,isRetain)
    return self
  elsif topic.class == String && payload.class.method_defined?(:j_del) && qosLevel.class == Symbol && (isDup.class == TrueClass || isDup.class == FalseClass) && (isRetain.class == TrueClass || isRetain.class == FalseClass) && block_given?
    @j_del.java_method(:publish, [Java::java.lang.String.java_class,Java::IoVertxCoreBuffer::Buffer.java_class,Java::IoNettyHandlerCodecMqtt::MqttQoS.java_class,Java::boolean.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call(topic,payload.j_del,Java::IoNettyHandlerCodecMqtt::MqttQoS.valueOf(qosLevel.to_s),isDup,isRetain,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish(#{topic},#{payload},#{qosLevel},#{isDup},#{isRetain})"
end

- (self) publish_acknowledge(publishMessageId = nil)

Sends the PUBACK message to the remote MQTT client

Parameters:

  • publishMessageId (Fixnum) (defaults to: nil)
    identifier of the PUBLISH message to acknowledge

Returns:

  • (self)

Raises:

  • (ArgumentError)


388
389
390
391
392
393
394
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 388

def publish_acknowledge(publishMessageId=nil)
  if publishMessageId.class == Fixnum && !block_given?
    @j_del.java_method(:publishAcknowledge, [Java::int.java_class]).call(publishMessageId)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish_acknowledge(#{publishMessageId})"
end

- (self) publish_acknowledge_handler { ... }

Set the puback handler on the MQTT endpoint. This handler is called when a PUBACK message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


267
268
269
270
271
272
273
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 267

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

- (self) publish_auto_ack(isPublishAutoAck = nil)

Enable/disable publishing (in/out) auto acknowledge

Parameters:

  • isPublishAutoAck (true, false) (defaults to: nil)
    auto acknowledge status

Returns:

  • (self)

Raises:

  • (ArgumentError)


171
172
173
174
175
176
177
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 171

def publish_auto_ack(isPublishAutoAck=nil)
  if (isPublishAutoAck.class == TrueClass || isPublishAutoAck.class == FalseClass) && !block_given?
    @j_del.java_method(:publishAutoAck, [Java::boolean.java_class]).call(isPublishAutoAck)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish_auto_ack(#{isPublishAutoAck})"
end

- (true, false) publish_auto_ack?

Returns auto acknowledge status for publishing (in/out)

Returns:

  • (true, false)
    auto acknowledge status for publishing (in/out)

Raises:

  • (ArgumentError)


179
180
181
182
183
184
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 179

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

- (self) publish_complete(publishMessageId = nil)

Sends the PUBCOMP message to the remote MQTT client

Parameters:

  • publishMessageId (Fixnum) (defaults to: nil)
    identifier of the PUBLISH message to acknowledge

Returns:

  • (self)

Raises:

  • (ArgumentError)


418
419
420
421
422
423
424
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 418

def publish_complete(publishMessageId=nil)
  if publishMessageId.class == Fixnum && !block_given?
    @j_del.java_method(:publishComplete, [Java::int.java_class]).call(publishMessageId)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish_complete(#{publishMessageId})"
end

- (self) publish_completion_handler { ... }

Set the pubcomp handler on the MQTT endpoint. This handler is called when a PUBCOMP message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


300
301
302
303
304
305
306
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 300

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

- (self) publish_handler { ... }

Set the publish handler on the MQTT endpoint. This handler is called when a PUBLISH message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


256
257
258
259
260
261
262
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 256

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

- (self) publish_received(publishMessageId = nil)

Sends the PUBREC message to the remote MQTT client

Parameters:

  • publishMessageId (Fixnum) (defaults to: nil)
    identifier of the PUBLISH message to acknowledge

Returns:

  • (self)

Raises:

  • (ArgumentError)


398
399
400
401
402
403
404
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 398

def publish_received(publishMessageId=nil)
  if publishMessageId.class == Fixnum && !block_given?
    @j_del.java_method(:publishReceived, [Java::int.java_class]).call(publishMessageId)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish_received(#{publishMessageId})"
end

- (self) publish_received_handler { ... }

Set the pubrec handler on the MQTT endpoint. This handler is called when a PUBREC message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


278
279
280
281
282
283
284
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 278

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

- (self) publish_release(publishMessageId = nil)

Sends the PUBREL message to the remote MQTT client

Parameters:

  • publishMessageId (Fixnum) (defaults to: nil)
    identifier of the PUBLISH message to acknowledge

Returns:

  • (self)

Raises:

  • (ArgumentError)


408
409
410
411
412
413
414
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 408

def publish_release(publishMessageId=nil)
  if publishMessageId.class == Fixnum && !block_given?
    @j_del.java_method(:publishRelease, [Java::int.java_class]).call(publishMessageId)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling publish_release(#{publishMessageId})"
end

- (self) publish_release_handler { ... }

Set the pubrel handler on the MQTT endpoint. This handler is called when a PUBREL message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


289
290
291
292
293
294
295
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 289

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

- (self) reject(returnCode = nil)

Sends the CONNACK message to the remote MQTT client rejecting the connection request with specified return code. See #accept for accepting connection

Parameters:

  • returnCode (:CONNECTION_ACCEPTED, :CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION, :CONNECTION_REFUSED_IDENTIFIER_REJECTED, :CONNECTION_REFUSED_SERVER_UNAVAILABLE, :CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD, :CONNECTION_REFUSED_NOT_AUTHORIZED) (defaults to: nil)
    the connect return code

Returns:

  • (self)

Raises:

  • (ArgumentError)


357
358
359
360
361
362
363
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 357

def reject(returnCode=nil)
  if returnCode.class == Symbol && !block_given?
    @j_del.java_method(:reject, [Java::IoNettyHandlerCodecMqtt::MqttConnectReturnCode.java_class]).call(Java::IoNettyHandlerCodecMqtt::MqttConnectReturnCode.valueOf(returnCode.to_s))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling reject(#{returnCode})"
end

- (::Vertx::SocketAddress) remote_address

Returns the remote address for this socket

Returns:

Raises:

  • (ArgumentError)


46
47
48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 46

def remote_address
  if !block_given?
    if @cached_remote_address != nil
      return @cached_remote_address
    end
    return @cached_remote_address = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:remoteAddress, []).call(),::Vertx::SocketAddress)
  end
  raise ArgumentError, "Invalid arguments when calling remote_address()"
end

- (self) set_client_identifier(clientIdentifier = nil)

Set client identifier if not provided by the remote MQTT client (zero-bytes)

Parameters:

  • clientIdentifier (String) (defaults to: nil)
    the client identifier

Returns:

  • (self)

Raises:

  • (ArgumentError)


212
213
214
215
216
217
218
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 212

def set_client_identifier(clientIdentifier=nil)
  if clientIdentifier.class == String && !block_given?
    @j_del.java_method(:setClientIdentifier, [Java::java.lang.String.java_class]).call(clientIdentifier)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_client_identifier(#{clientIdentifier})"
end

- (true, false) ssl?

Returns true if this VertxMqtt::MqttEndpoint is encrypted via SSL/TLS.

Returns:

Raises:

  • (ArgumentError)


66
67
68
69
70
71
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 66

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

- (self) subscribe_acknowledge(subscribeMessageId = nil, grantedQoSLevels = nil)

Sends the SUBACK message to the remote MQTT client

Parameters:

  • subscribeMessageId (Fixnum) (defaults to: nil)
    identifier of the SUBSCRIBE message to acknowledge
  • grantedQoSLevels (Array<:AT_MOST_ONCE,:AT_LEAST_ONCE,:EXACTLY_ONCE,:FAILURE>) (defaults to: nil)
    granted QoS levels for the requested topics

Returns:

  • (self)

Raises:

  • (ArgumentError)


368
369
370
371
372
373
374
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 368

def subscribe_acknowledge(subscribeMessageId=nil,grantedQoSLevels=nil)
  if subscribeMessageId.class == Fixnum && grantedQoSLevels.class == Array && !block_given?
    @j_del.java_method(:subscribeAcknowledge, [Java::int.java_class,Java::JavaUtil::List.java_class]).call(subscribeMessageId,grantedQoSLevels.map { |element| Java::IoNettyHandlerCodecMqtt::MqttQoS.valueOf(element.to_s) })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling subscribe_acknowledge(#{subscribeMessageId},#{grantedQoSLevels})"
end

- (self) subscribe_handler { ... }

Set a subscribe handler on the MQTT endpoint. This handler is called when a SUBSCRIBE message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


234
235
236
237
238
239
240
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 234

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

- (void) subscription_auto_ack(isSubscriptionAutoAck = nil)

This method returns an undefined value.

Enable/disable subscription/unsubscription requests auto acknowledge

Parameters:

  • isSubscriptionAutoAck (true, false) (defaults to: nil)
    auto acknowledge status

Raises:

  • (ArgumentError)


155
156
157
158
159
160
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 155

def subscription_auto_ack(isSubscriptionAutoAck=nil)
  if (isSubscriptionAutoAck.class == TrueClass || isSubscriptionAutoAck.class == FalseClass) && !block_given?
    return @j_del.java_method(:subscriptionAutoAck, [Java::boolean.java_class]).call(isSubscriptionAutoAck)
  end
  raise ArgumentError, "Invalid arguments when calling subscription_auto_ack(#{isSubscriptionAutoAck})"
end

- (true, false) subscription_auto_ack?

Returns true when auto acknowledge status for subscription/unsubscription requests

Returns:

  • (true, false)
    true when auto acknowledge status for subscription/unsubscription requests

Raises:

  • (ArgumentError)


162
163
164
165
166
167
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 162

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

- (self) unsubscribe_acknowledge(unsubscribeMessageId = nil)

Sends the UNSUBACK message to the remote MQTT client

Parameters:

  • unsubscribeMessageId (Fixnum) (defaults to: nil)
    identifier of the UNSUBSCRIBE message to acknowledge

Returns:

  • (self)

Raises:

  • (ArgumentError)


378
379
380
381
382
383
384
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 378

def unsubscribe_acknowledge(unsubscribeMessageId=nil)
  if unsubscribeMessageId.class == Fixnum && !block_given?
    @j_del.java_method(:unsubscribeAcknowledge, [Java::int.java_class]).call(unsubscribeMessageId)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling unsubscribe_acknowledge(#{unsubscribeMessageId})"
end

- (self) unsubscribe_handler { ... }

Set a unsubscribe handler on the MQTT endpoint. This handler is called when a UNSUBSCRIBE message is received by the remote MQTT client

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


245
246
247
248
249
250
251
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-mqtt/mqtt_endpoint.rb', line 245

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

- (Hash) will

Returns the Will information as provided by the remote MQTT client

Returns:

  • (Hash)
    the Will information as provided by the remote MQTT client

Raises:

  • (ArgumentError)


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-mqtt/mqtt_endpoint.rb', line 93

def will
  if !block_given?
    if @cached_will != nil
      return @cached_will
    end
    return @cached_will = @j_del.java_method(:will, []).call() != nil ? JSON.parse(@j_del.java_method(:will, []).call().toJson.encode) : nil
  end
  raise ArgumentError, "Invalid arguments when calling will()"
end