/** * Send a message with an ID and content. * * @param id The ID associated with the message. * @param content The content of the message. * @throws PubSubException if the messaging system throws an error. */ default void send(String id, String content) throws PubSubException { send(new PubSubMessage(id, content)); }
/** * Publishes a message through the {@link Publisher} instance and acks the tuple even if the publishing failed. * * @param message The {@link PubSubMessage} to publish. * @param tuple The {@link Tuple} to ack. */ protected void publish(PubSubMessage message, Tuple tuple) { try { publisher.send(message); } catch (PubSubException e) { log.error(e.getMessage()); } collector.ack(tuple); }
/** * Publishes a message through the {@link Publisher} instance and acks the tuple even if the publishing failed. * * @param message The {@link PubSubMessage} to publish. * @param tuple The {@link Tuple} to ack. */ protected void publish(PubSubMessage message, Tuple tuple) { try { publisher.send(message); } catch (PubSubException e) { log.error(e.getMessage()); } collector.ack(tuple); }