/** * Publishes the specified message to this topic, but does not wait for delivery * of the message to complete. The returned {@link MqttDeliveryToken token} can be used * to track the delivery status of the message. Once this method has * returned cleanly, the message has been accepted for publication by the * client. Message delivery will be completed in the background when a connection * is available. * * @param message the message to publish * @return an MqttDeliveryToken for tracking the delivery of the message * @throws MqttException if an error occurs publishing the message * @throws MqttPersistenceException if an error occurs persisting the message */ public MqttDeliveryToken publish(MqttMessage message) throws MqttException, MqttPersistenceException { MqttDeliveryToken token = new MqttDeliveryToken(comms.getClient().getClientId()); token.setMessage(message); comms.sendNoWait(createPublish(message), token); token.internalTok.waitUntilSent(); return token; }
/** * Publishes the specified message to this topic, but does not wait for delivery * of the message to complete. The returned {@link MqttDeliveryToken token} can be used * to track the delivery status of the message. Once this method has * returned cleanly, the message has been accepted for publication by the * client. Message delivery will be completed in the background when a connection * is available. * * @param message the message to publish * @return an MqttDeliveryToken for tracking the delivery of the message */ public MqttDeliveryToken publish(MqttMessage message) throws MqttException, MqttPersistenceException { MqttDeliveryToken token = new MqttDeliveryToken(comms.getClient().getClientId()); token.setMessage(message); comms.sendNoWait(createPublish(message), token); token.internalTok.waitUntilSent(); return token; }
/** * Publishes the specified message to this topic, but does not wait for delivery * of the message to complete. The returned {@link MqttDeliveryToken token} can be used * to track the delivery status of the message. Once this method has * returned cleanly, the message has been accepted for publication by the * client. Message delivery will be completed in the background when a connection * is available. * * @param message the message to publish * @return an MqttDeliveryToken for tracking the delivery of the message * @throws MqttException if an error occurs publishing the message * @throws MqttPersistenceException if an error occurs persisting the message */ public MqttDeliveryToken publish(MqttMessage message) throws MqttException, MqttPersistenceException { MqttDeliveryToken token = new MqttDeliveryToken(comms.getClient().getClientId()); token.setMessage(message); comms.sendNoWait(createPublish(message), token); token.internalTok.waitUntilSent(); return token; }
/** * Publishes the specified message to this topic, but does not wait for delivery * of the message to complete. The returned {@link MqttDeliveryToken token} can be used * to track the delivery status of the message. Once this method has * returned cleanly, the message has been accepted for publication by the * client. Message delivery will be completed in the background when a connection * is available. * * @param message the message to publish * @return an MqttDeliveryToken for tracking the delivery of the message * @throws MqttException if an error occurs publishing the message * @throws MqttPersistenceException if an error occurs persisting the message */ public MqttDeliveryToken publish(MqttMessage message) throws MqttException, MqttPersistenceException { MqttDeliveryToken token = new MqttDeliveryToken(comms.getClient().getClientId()); token.setMessage(message); comms.sendNoWait(createPublish(message), token); token.internalTok.waitUntilSent(); return token; }