@ProviderType public interface PersistentMessagePublisher extends MessagePublisher
Note: Due to the nature how the broker's confirmation receipts are sent, PersistentMessagePublisher.PublishReceipt
is always available asynchronously only. Message correlation tokens are used to
track broker responses.
Modifier and Type | Interface and Description |
---|---|
static interface |
PersistentMessagePublisher.MessagePublishReceiptListener
An interface for listeners that process notifications about message delivered to the broker
(success or failures).
|
static class |
PersistentMessagePublisher.PublishReceipt
A class that encapsulates broker acknowledgement or failed publishing attempts, used for
message delivery notification processing such as timestamp, correlation token, original
message, indicator if message was persisted on a broker.
|
LifecycleControl.TerminationEvent, LifecycleControl.TerminationNotificationListener
PublisherHealthCheck.PublisherReadinessListener
ManageablePublisher.DirectPublisherInfo, ManageablePublisher.PersistentPublisherInfo, ManageablePublisher.PublisherInfo
Modifier and Type | Method and Description |
---|---|
void |
publish(byte[] message,
Topic destination)
Sends a persistent byte-array message to the given destination using defaults.
|
void |
publish(byte[] message,
Topic destination,
Object userContext)
Sends a persistent byte array message to the given destination using defaults.
|
void |
publish(OutboundMessage message,
Topic destination)
Sends a persistent message; nonblocking
|
void |
publish(OutboundMessage message,
Topic destination,
Object userContext)
Sends a persistent message to the given destination, non blocking
|
void |
publish(OutboundMessage message,
Topic destination,
Object userContext,
Properties additionalMessageProperties)
Sends a persistent message to the given destination, non-blocking
|
void |
publish(String message,
Topic destination)
Sends a UTF-8 encoded persistent text message as a payload to the given destination using
defaults.
|
void |
publish(String message,
Topic destination,
Object userContext)
Sends a UTF-8 encoded persistent text message as the payload to the given destination using
defaults.
|
void |
publishAwaitAcknowledgement(OutboundMessage message,
Topic destination,
long timeout)
Sends a persistent message, blocking until delivery acknowledgement is received or timeout
occurs.
|
void |
publishAwaitAcknowledgement(OutboundMessage message,
Topic destination,
long timeout,
Properties additionalMessageProperties)
Sends a persistent message, blocking until delivery acknowledgement is received or timeout
occurs
|
ManageablePublisher.PersistentPublisherInfo |
publisherInfo()
Provides access to the publisher information.
|
void |
setMessagePublishReceiptListener(PersistentMessagePublisher.MessagePublishReceiptListener listener)
Sets
MessagePublishReceiptListener for the given instance of the publisher. |
PersistentMessagePublisher |
start()
Enables service regular duties.
|
<PersistentMessagePublisher> |
startAsync()
Asynchronously starts service for consuming/publishing operations.
|
<PersistentMessagePublisher> |
startAsync(CompletionListener<PersistentMessagePublisher> startListener)
Asynchronously starts service for consuming/publishing operations using a callback for
completion notification.
|
isRunning, isTerminated, isTerminating, setTerminationNotificationListener, terminate
terminateAsync, terminateAsync
isReady, notifyWhenReady, setPublisherReadinessListener
void publish(byte[] message, Topic destination) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
message
- the raw byte payload of the message to senddestination
- the message destination (topic)PubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(byte[] message, Topic destination, Object userContext) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements are processed using separately registered PersistentMessagePublisher.MessagePublishReceiptListener
calls.
message
- the raw-byte payload of the message to senddestination
- the message destination (topic)userContext
- the context associated with an action that is performed when the message
delivery to the broker is confirmed using PersistentMessagePublisher.MessagePublishReceiptListener
and PersistentMessagePublisher.PublishReceipt
. When the user-context is not supposed to be
available, use the method instead without the userContext
parameterPubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(OutboundMessage message, Topic destination) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements processed using separately registered MessagePublishReceiptListener
interface.
message
- the message to senddestination
- the message destination (topic)PubSubPlusClientException
- when message can't be send and retry attempts would not
helpPubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(OutboundMessage message, Topic destination, Object userContext) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements processed using separately registered PersistentMessagePublisher.MessagePublishReceiptListener
message
- the message to senddestination
- the message destination (topic)userContext
- the context associated with an action that is performed when the message
delivery to the broker is confirmed using MessagePublishReceiptListener#onPublishReceipt(PublishReceipt)
.
When the user-context is not supposed to be available, use the method
instead without the userContext
parameterPubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(OutboundMessage message, Topic destination, Object userContext, Properties additionalMessageProperties) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements processed using separately registered PersistentMessagePublisher.MessagePublishReceiptListener
message
- the message to senddestination
- the message destination (topic)userContext
- the context associated with an action that is performed when
the message delivery to the broker is confirmed using MessagePublishReceiptListener#onPublishReceipt(PublishReceipt)
When the user-context is not supposed to be available, use
the method instead without the userContext
parameteradditionalMessageProperties
- additional properties (Key of type String
and Value
of type String
), to customize a particular message,
each key can be customer provided, or it can be a key from a
SolaceProperties.MessageProperties
PubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(String message, Topic destination) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements processed using separately registered
PersistentMessagePublisher.MessagePublishReceiptListener
interface.
message
- string payload of the message to be senddestination
- the message destination (topic)PubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publish(String message, Topic destination, Object userContext) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
Message acknowledgements processed using separately registered PersistentMessagePublisher.MessagePublishReceiptListener
interface.
message
- the string-based payload of the message to senddestination
- the message destination (topic)userContext
- the context associated with an action that is performed when the message
delivery to the broker is confirmed using MessagePublishReceiptListener#onPublishReceipt(PublishReceipt)
.
When the user-context is not supposed to be available, use the method
instead without the userContext
parameterPubSubPlusClientException
- if the message cannot be sent and retry attempts would not
helpPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages faster then I/O capabilities
allow for messages to be sent or internal message buffering
capabilities have been exceededIllegalStateException
- if the message publisher has not started or has been
terminatedIllegalArgumentException
- if the message
or destination
are null
void publishAwaitAcknowledgement(OutboundMessage message, Topic destination, long timeout) throws PubSubPlusClientException.TimeoutException, PubSubPlusClientException.MessageRejectedByBrokerException, PubSubPlusClientException.PublisherOverflowException, PubSubPlusClientException.MessageDestinationDoesNotExistException, PubSubPlusClientException.MessageNotAcknowledgedByBrokerException, PubSubPlusClientException, InterruptedException
message
- the message to senddestination
- the message destination (topic)timeout
- the maximum time to wait for the message acknowledgement (in milliseconds)PubSubPlusClientException.TimeoutException
- if after the specified timeout
has
elapsed and no response has been receivedPubSubPlusClientException.MessageRejectedByBrokerException
- if the message was rejected from the broker for
some reasonPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages too fast; an
attempt to re-publish the message immediately
or after some time can be donePubSubPlusClientException.MessageDestinationDoesNotExistException
- if the specified message destination does not
existPubSubPlusClientException.MessageNotAcknowledgedByBrokerException
- if the broker could not acknowledge message
persistence on a brokerPubSubPlusClientException
- if some internal error occurredIllegalArgumentException
- if the value of timeout
is negativeInterruptedException
- if any thread has interrupted the current
thread; the interrupted status of the
current thread is cleared when this exception
is thrownvoid publishAwaitAcknowledgement(OutboundMessage message, Topic destination, long timeout, Properties additionalMessageProperties) throws PubSubPlusClientException.TimeoutException, PubSubPlusClientException.MessageRejectedByBrokerException, PubSubPlusClientException.PublisherOverflowException, PubSubPlusClientException.MessageDestinationDoesNotExistException, PubSubPlusClientException.MessageNotAcknowledgedByBrokerException, PubSubPlusClientException, InterruptedException
message
- the message to senddestination
- the message destination (topic)timeout
- the maximum time to wait for the message acknowledgement (in
milliseconds)additionalMessageProperties
- the additional properties (Key of type String
and
Value of type String
) to customize a particular
message where each key can be customer-provided, or it can
be a key from a SolaceProperties.MessageProperties
objectPubSubPlusClientException.TimeoutException
- if after the specified timeout
has
elapsed and no response has been receivedPubSubPlusClientException.MessageRejectedByBrokerException
- if the message was rejected from the broker for
some reasonPubSubPlusClientException.PublisherOverflowException
- if the publisher sends messages too fast; an
attempt to re-publish the message immediately
or after some time can be donePubSubPlusClientException.MessageDestinationDoesNotExistException
- if the specified message destination does not
existPubSubPlusClientException.MessageNotAcknowledgedByBrokerException
- if the broker could not acknowledge message
persistence on the brokerPubSubPlusClientException
- if some internal error occurredIllegalArgumentException
- if the value of timeout
is negativeInterruptedException
- if any thread has interrupted the current
thread; the interrupted status of the
current thread is cleared when this exception
is thrownManageablePublisher.PersistentPublisherInfo publisherInfo()
ManageablePublisher
publisherInfo
in interface ManageablePublisher
PublisherInfo
objectvoid setMessagePublishReceiptListener(PersistentMessagePublisher.MessagePublishReceiptListener listener)
MessagePublishReceiptListener
for the given instance of the publisher. It is used
to notify about all messages published to the broker with corresponding confirmations or
failures.listener
- the listener to process message publish confirmations or failuresPersistentMessagePublisher start()
LifecycleControl
start
in interface LifecycleControl
<PersistentMessagePublisher> CompletableFuture<PersistentMessagePublisher> startAsync() throws PubSubPlusClientException
AsyncLifecycleControl
This method is an idempotent operation when no another connect/disconnect operation is ongoing.
startAsync
in interface AsyncLifecycleControl
PubSubPlusClientException
- if the messaging service will not start in the future<PersistentMessagePublisher> void startAsync(CompletionListener<PersistentMessagePublisher> startListener) throws PubSubPlusClientException, IllegalStateException
AsyncLifecycleControl
startAsync
in interface AsyncLifecycleControl
PersistentMessagePublisher
- the type of response returned on a successful start operationstartListener
- the callback for future notifications about the completion of the start
processPubSubPlusClientException
- if the messaging service will not start in the futureIllegalStateException
- if the method has been invoked at an illegal or inappropriate
timeCopyright 2019-2024 Solace Corporation. All rights reserved.