@ProviderType public interface DirectMessagePublisher extends MessagePublisher
| Modifier and Type | Interface and Description |
|---|---|
static class |
DirectMessagePublisher.FailedPublishEvent
A class that encapsulates the details of a failed attempt to publish a message.
|
static interface |
DirectMessagePublisher.PublishFailureListener
An interface that provides an abstraction for listeners of failed message publishing attempts.
|
LifecycleControl.TerminationEvent, LifecycleControl.TerminationNotificationListenerPublisherHealthCheck.PublisherReadinessListenerManageablePublisher.DirectPublisherInfo, ManageablePublisher.PersistentPublisherInfo, ManageablePublisher.PublisherInfo| Modifier and Type | Method and Description |
|---|---|
void |
publish(byte[] message,
Topic destination)
Sends a byte-array message to the given destination using defaults This method is
non-blocking.
|
void |
publish(OutboundMessage message,
Topic destination)
Sends an
OutboundMessage to the given destination, non blocking. |
void |
publish(OutboundMessage message,
Topic destination,
Properties additionalMessageProperties)
Sends
OutboundMessage to the given destination, extendedMessageProperties can
be included into the message, non blocking. |
void |
publish(String message,
Topic destination)
Sends a UTF-8 encoded-text message (payload) to the specified destination using defaults This
method is non-blocking.
|
ManageablePublisher.DirectPublisherInfo |
publisherInfo()
Provides access to the publisher information.
|
void |
setPublishFailureListener(DirectMessagePublisher.PublishFailureListener listener)
Sets the callback for the instance of the publisher.
|
DirectMessagePublisher |
start()
Enables service regular duties.
|
<DirectMessagePublisher> |
startAsync()
Asynchronously starts service for consuming/publishing operations.
|
<DirectMessagePublisher> |
startAsync(CompletionListener<DirectMessagePublisher> startListener)
Asynchronously starts service for consuming/publishing operations using a callback for
completion notification.
|
isRunning, isTerminated, isTerminating, setTerminationNotificationListener, terminateterminateAsync, terminateAsyncisReady, notifyWhenReady, setPublisherReadinessListenervoid publish(byte[] message,
Topic destination)
throws PubSubPlusClientException,
IllegalStateException,
IllegalArgumentException,
PubSubPlusClientException.PublisherOverflowException
message - the byte payloaddestination - the message destination (topic)PubSubPlusClientException - if the message can't be sentPubSubPlusClientException.PublisherOverflowException - if the publisher sends a message faster then the I/O
capabilities allow to send or the internal message buffering
capabilities are exceededIllegalStateException - if the message publisher has not started or has been
terminatedIllegalArgumentException - if the message or the destination was nullvoid publish(OutboundMessage message, Topic destination) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
OutboundMessage to the given destination, non blocking.
The OutboundMessageBuilder class can be used to create a new message
instance. For example:
OutboundMessageBuilder messageBuilder = messagePublisher.createMessageBuilder();
message - the entire message, payload, and additional message properties that can be
defined in the message; a null value is not alloweddestination - destination the destination (topic)PubSubPlusClientException - if the message can't be sentPubSubPlusClientException.PublisherOverflowException - if the publisher sends a message faster then the I/O
capabilities allow to send or the internal message buffering
capabilities are exceededIllegalStateException - if the message publisher was not started or has been
terminatedIllegalArgumentException - if the message or the destination was nullvoid publish(OutboundMessage message, Topic destination, Properties additionalMessageProperties) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
OutboundMessage to the given destination, extendedMessageProperties can
be included into the message, non blocking.
OutboundMessageBuilder can be used to create a new message
instance.
message - the entire message, payload, and additional message
properties can be defined in the message; a null
value is not permitteddestination - destination the destination for the message specified as a
topicadditionalMessageProperties - 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
instancePubSubPlusClientException - if the message can't be sentPubSubPlusClientException.PublisherOverflowException - if the publisher sends a message faster then the I/O
capabilities allow to send or the internal message buffering
capabilities are exceededIllegalStateException - if the message publisher is not started or has been
terminatedIllegalArgumentException - if the message or the destination is nullvoid publish(String message, Topic destination) throws PubSubPlusClientException, IllegalStateException, IllegalArgumentException, PubSubPlusClientException.PublisherOverflowException
message - the UTF-8 encoded-text string representing the payloaddestination - destination the destination (topic)PubSubPlusClientException - if the message can't be sentPubSubPlusClientException.PublisherOverflowException - if the publisher sends a message faster then the I/O
capabilities allow to send or the internal message buffering
capabilities are exceededIllegalStateException - if the message publisher is not started or has been
terminatedIllegalArgumentException - if the message or the destination was nullManageablePublisher.DirectPublisherInfo publisherInfo()
ManageablePublisherpublisherInfo in interface ManageablePublisherPublisherInfo objectvoid setPublishFailureListener(DirectMessagePublisher.PublishFailureListener listener)
listener - the callback that listens for message publishing failuresDirectMessagePublisher start()
LifecycleControlstart in interface LifecycleControl<DirectMessagePublisher> CompletableFuture<DirectMessagePublisher> startAsync() throws PubSubPlusClientException
AsyncLifecycleControlThis method is an idempotent operation when no another connect/disconnect operation is ongoing.
startAsync in interface AsyncLifecycleControlPubSubPlusClientException - if the messaging service will not start in the future<DirectMessagePublisher> void startAsync(CompletionListener<DirectMessagePublisher> startListener) throws PubSubPlusClientException, IllegalStateException
AsyncLifecycleControlstartAsync in interface AsyncLifecycleControlDirectMessagePublisher - 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-2025 Solace Corporation. All rights reserved.