@ProviderType public interface RequestReplyMessageReceiver extends MessageReceiver
This API expected to be thread safe.
Modifier and Type | Interface and Description |
---|---|
static class |
RequestReplyMessageReceiver.FailedReplyEvent
A class that encapsulates the details of a failed attempt to publish a reply message.
|
static interface |
RequestReplyMessageReceiver.Replier
An interface to perform reply operations for a received request message.
|
static interface |
RequestReplyMessageReceiver.ReplyFailureListener
An interface that provides an abstraction for listeners of failed message reply attempts.
|
static interface |
RequestReplyMessageReceiver.RequestMessageHandler
An interface to handle a request message and perform a reply or response for the request-reply
use case.
|
MessageReceiver.FailedReceiveEvent, MessageReceiver.InboundMessageSupplier, MessageReceiver.MessageHandler, MessageReceiver.ReceiveFailureListener
LifecycleControl.TerminationEvent, LifecycleControl.TerminationNotificationListener
ManageableReceiver.DirectReceiverInfo, ManageableReceiver.PersistentReceiverInfo
Modifier and Type | Method and Description |
---|---|
void |
receiveAsync(RequestReplyMessageReceiver.RequestMessageHandler messageHandler)
Request to register an async request message handler.
|
void |
receiveAsync(RequestReplyMessageReceiver.RequestMessageHandler messageHandler,
ExecutorService executorService)
Request to register an asynchronous request message handler using supplied thread executor for
callbacks.
|
void |
receiveMessage(RequestReplyMessageReceiver.RequestMessageHandler messageHandler)
Receive the next request message to be processed with a given
RequestMessageHandler . |
void |
receiveMessage(RequestReplyMessageReceiver.RequestMessageHandler messageHandler,
long timeOut)
Receive the next request message to be processed with a given
RequestMessageHandler . |
void |
setReplyFailureListener(RequestReplyMessageReceiver.ReplyFailureListener listener)
Sets the callback for the instance of the publisher.
|
RequestReplyMessageReceiver |
start()
Enables service regular duties.
|
<RequestReplyMessageReceiver> |
startAsync()
Asynchronously starts service for consuming/publishing operations.
|
<RequestReplyMessageReceiver> |
startAsync(CompletionListener<RequestReplyMessageReceiver> startListener)
Asynchronously starts service for consuming/publishing operations using a callback for
completion notification.
|
setReceiveFailureListener
isRunning, isTerminated, isTerminating, setTerminationNotificationListener, terminate
terminateAsync, terminateAsync
receiverInfo
void receiveAsync(RequestReplyMessageReceiver.RequestMessageHandler messageHandler) throws PubSubPlusClientException
messageHandler
- the request message handler, to handle an ordered sequence of inbound
request messagesPubSubPlusClientException
- is thrown when messages handler can't be registeredvoid receiveAsync(RequestReplyMessageReceiver.RequestMessageHandler messageHandler, ExecutorService executorService) throws PubSubPlusClientException
messageHandler
- the request message handler to handle the sequence of inbound request
messagesexecutorService
- the user-provided instance of thread executor for message scheduling and
MessageReceiver.MessageHandler.onMessage(InboundMessage)
execution
Important:
The shutdown of the Executor service or any another maintenance work is the responsibility of the developer
When the order of the messages needs to be preserved, a single thread-based executor is required
PubSubPlusClientException
- if the messages handler cannot be registeredvoid receiveMessage(RequestReplyMessageReceiver.RequestMessageHandler messageHandler) throws PubSubPlusClientException
RequestMessageHandler
.
Response to the received request message can be performed using provided RequestReplyMessageReceiver.Replier
. This
is a blocking request.messageHandler
- the request message handler.PubSubPlusClientException
- if the message could not be receivedPubSubPlusClientException.RequestInterruptedException
- if the thread is interrupted while waiting for the next
message; an interrupted flag is expected to be set on the
thread in this casevoid receiveMessage(RequestReplyMessageReceiver.RequestMessageHandler messageHandler, long timeOut) throws PubSubPlusClientException
RequestMessageHandler
.
Response to the received request message can be performed using provided RequestReplyMessageReceiver.Replier
. This
is a blocking request.messageHandler
- the request message handler.timeOut
- the timeout (in milliseconds) after the blocking receive exits, values
> 0 are expectedPubSubPlusClientException
- if the message could not be receivedPubSubPlusClientException.RequestInterruptedException
- if the thread is interrupted while waiting for the next
message; an interrupted flag is expected to be set on the
thread in this casevoid setReplyFailureListener(RequestReplyMessageReceiver.ReplyFailureListener listener)
listener
- the callback that listens for message publishing failuresRequestReplyMessageReceiver start() throws PubSubPlusClientException
LifecycleControl
start
in interface LifecycleControl
start
in interface MessageReceiver
PubSubPlusClientException
- if the instance fails to start for some internal reason<RequestReplyMessageReceiver> CompletableFuture<RequestReplyMessageReceiver> startAsync()
AsyncLifecycleControl
This method is an idempotent operation when no another connect/disconnect operation is ongoing.
startAsync
in interface AsyncLifecycleControl
startAsync
in interface MessageReceiver
<RequestReplyMessageReceiver> void startAsync(CompletionListener<RequestReplyMessageReceiver> startListener) throws PubSubPlusClientException, IllegalStateException
AsyncLifecycleControl
startAsync
in interface AsyncLifecycleControl
RequestReplyMessageReceiver
- 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.