public void cancel(T message) { IMessagePublication publication = publications.get(message); if (publication != null) { publication.markCancelled(); } }
/** * Synchronously publish a message to all registered listeners (this includes listeners defined * for super types) The call blocks until every messageHandler has processed the message. * * @param message */ public void publish(T message) { updatePublications(); try { IMessagePublication publication = createMessagePublication(message); publications.put(message, publication); publication.execute(); } catch (Throwable e) { handlePublicationError( new PublicationError() .setMessage("Error during publication of message") .setCause(e) .setPublishedMessage(message)); } }