message.payload() + "] with QoS [" + message.qosLevel() + "]"); });
System.out.println("Just received message on [" + publish.topicName() + "] payload [" + publish.payload().toString(Charset.defaultCharset()) + "] with QoS [" + publish.qosLevel() + "]"); });
System.out.println("Just received message on [" + message.topicName() + "] payload [" + message.payload() + "] with QoS [" + message.qosLevel() + "]");
/** * Measure the size of the payload for using in the metrics system. * <p> * This implementation simply counts the bytes of the MQTT payload buffer and ignores all other attributes of the * message. * * @param message The message to measure the payload size. May be {@code null}. * @return The number of bytes of the payload or zero if any input is {@code null}. */ protected long messagePayloadSize(final MqttPublishMessage message) { if (message == null || message.payload() == null) { return 0L; } return message.payload().length(); }
/** * Measure the size of the payload for using in the metrics system. * <p> * This implementation simply counts the bytes of the MQTT payload buffer and ignores all other attributes of the * message. * * @param message The message to measure the payload size. May be {@code null}. * @return The number of bytes of the payload or zero if any input is {@code null}. */ protected long messagePayloadSize(final MqttPublishMessage message) { if (message == null || message.payload() == null) { return 0L; } return message.payload().length(); }
/** * @return Payload message */ public io.vertx.rxjava.core.buffer.Buffer payload() { if (cached_5 != null) { return cached_5; } io.vertx.rxjava.core.buffer.Buffer ret = io.vertx.rxjava.core.buffer.Buffer.newInstance(delegate.payload()); cached_5 = ret; return ret; }
/** * @return Payload message */ public io.vertx.rxjava.core.buffer.Buffer payload() { if (cached_5 != null) { return cached_5; } io.vertx.rxjava.core.buffer.Buffer ret = io.vertx.rxjava.core.buffer.Buffer.newInstance(delegate.payload()); cached_5 = ret; return ret; }
/** * @return Payload message */ public Buffer payload() { if (cached_5 != null) { return cached_5; } Buffer ret = Buffer.newInstance(delegate.payload()); cached_5 = ret; return ret; }
publish.isRetain(), publish.topicName(), publish.payload());
private void subscribeAndReceive(TestContext context, MqttQoS qos) { Async async = context.async(); MqttClient client = MqttClient.create(Vertx.vertx()); client.publishHandler(publish -> { assertTrue(publish.qosLevel() == qos); log.info("Just received message on [" + publish.topicName() + "] payload [" + publish.payload().toString(Charset.defaultCharset()) + "] with QoS [" + publish.qosLevel() + "]"); client.disconnect(); async.countDown(); }); client.connect(TestUtil.BROKER_PORT, TestUtil.BROKER_ADDRESS, ar -> { assertTrue(ar.succeeded()); client.subscribe(MQTT_TOPIC, qos.value()); client.publish( MQTT_TOPIC, Buffer.buffer(MQTT_MESSAGE.getBytes()), qos, false, false ); }); async.await(); }
private void subscribeAndReceive(TestContext context, MqttQoS qos) { Async async = context.async(); MqttClient client = MqttClient.create(Vertx.vertx()); client.publishHandler(publish -> { assertTrue(publish.qosLevel() == qos); log.info("Just received message on [" + publish.topicName() + "] payload [" + publish.payload().toString(Charset.defaultCharset()) + "] with QoS [" + publish.qosLevel() + "]"); client.disconnect(); async.countDown(); }); client.connect(TestUtil.BROKER_PORT, TestUtil.BROKER_ADDRESS, ar -> { assertTrue(ar.succeeded()); client.subscribe(MQTT_TOPIC, qos.value()); client.publish( MQTT_TOPIC, Buffer.buffer(MQTT_MESSAGE.getBytes()), qos, false, false ); }); async.await(); }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.publishHandler(message -> { log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]"); switch (message.qosLevel()) { case AT_LEAST_ONCE: endpoint.publishAcknowledge(message.messageId()); this.async.complete(); break; case EXACTLY_ONCE: endpoint.publishReceived(message.messageId()); break; case AT_MOST_ONCE: this.async.complete(); break; } }).publishReleaseHandler(messageId -> { endpoint.publishComplete(messageId); this.async.complete(); }); endpoint.accept(false); }
@Override protected void endpointHandler(MqttEndpoint endpoint, TestContext context) { endpoint.publishHandler(message -> { log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]"); switch (message.qosLevel()) { case AT_LEAST_ONCE: endpoint.publishAcknowledge(message.messageId()); this.async.complete(); break; case EXACTLY_ONCE: endpoint.publishReceived(message.messageId()); break; case AT_MOST_ONCE: this.async.complete(); break; } }).publishReleaseHandler(messageId -> { endpoint.publishComplete(messageId); this.async.complete(); }); endpoint.accept(false); }
log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]");
log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]");
log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]");
log.info("Just received message on [" + message.topicName() + "] payload [" + message.payload().toString(Charset.defaultCharset()) + "] with QoS [" + message.qosLevel() + "]");