Class: VertxMqttServer::MqttEndpoint

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/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-stack/stack-docs/target/rb/vertx-mqtt-server/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-stack/stack-docs/target/rb/vertx-mqtt-server/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-stack/stack-docs/target/rb/vertx-mqtt-server/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-stack/stack-docs/target/rb/vertx-mqtt-server/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-stack/stack-docs/target/rb/vertx-mqtt-server/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)


336
337
338
339
340
341
342
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 336

def accept(sessionPresent=nil)
  if (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)


76
77
78
79
80
81
82
83
84
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 76

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)


181
182
183
184
185
186
187
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 181

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)


189
190
191
192
193
194
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 189

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)


116
117
118
119
120
121
122
123
124
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 116

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)


66
67
68
69
70
71
72
73
74
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 66

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-stack/stack-docs/target/rb/vertx-mqtt-server/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)


315
316
317
318
319
320
321
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 315

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)


196
197
198
199
200
201
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 196

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)


216
217
218
219
220
221
222
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 216

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)


325
326
327
328
329
330
331
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 325

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)


126
127
128
129
130
131
132
133
134
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 126

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)


136
137
138
139
140
141
142
143
144
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 136

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-stack/stack-docs/target/rb/vertx-mqtt-server/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)


305
306
307
308
309
310
311
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 305

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)


431
432
433
434
435
436
437
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 431

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)


106
107
108
109
110
111
112
113
114
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 106

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)


96
97
98
99
100
101
102
103
104
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 96

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 client

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)
    quality of service 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

Returns:

  • (self)

Raises:

  • (ArgumentError)


422
423
424
425
426
427
428
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 422

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


378
379
380
381
382
383
384
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 378

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)


260
261
262
263
264
265
266
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 260

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)


164
165
166
167
168
169
170
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 164

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)


172
173
174
175
176
177
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 172

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)


408
409
410
411
412
413
414
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 408

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)


293
294
295
296
297
298
299
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 293

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)


249
250
251
252
253
254
255
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 249

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,::VertxMqttServer::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)


388
389
390
391
392
393
394
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 388

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)


271
272
273
274
275
276
277
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 271

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)


398
399
400
401
402
403
404
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 398

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)


282
283
284
285
286
287
288
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 282

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)


347
348
349
350
351
352
353
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 347

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-stack/stack-docs/target/rb/vertx-mqtt-server/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)


205
206
207
208
209
210
211
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 205

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

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


358
359
360
361
362
363
364
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 358

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)


227
228
229
230
231
232
233
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 227

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,::VertxMqttServer::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)


148
149
150
151
152
153
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 148

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)


155
156
157
158
159
160
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 155

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)


368
369
370
371
372
373
374
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 368

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)


238
239
240
241
242
243
244
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 238

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,::VertxMqttServer::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)


86
87
88
89
90
91
92
93
94
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-mqtt-server/mqtt_endpoint.rb', line 86

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