Class MessageDemux
java.lang.Object
de.aristaflow.ilm.core.runtimeservice.MessageDemux
This class extends the
LocalExecutionMessageNotifier by the means to notify listeners
without a reply and get this reply via another route. For instance, SSE does not allow to send
data, so the execution message is just notified and the reply is expected via the normal reply
method of the (remote) runtime environment. Internally this reply will then be forwarded to the
corresponding notifier awaiting the reply synchronously.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final LocalExecutionMessageNotifierThe wrapped message notifier.protected final Map<String,Map<Long, CompletableFuture<ReplyMessage<?>>>> The futures awaited by server notifications indexed by session ID and message ID. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new execution message notifier handling listeners via the designated notifier. -
Method Summary
Modifier and TypeMethodDescriptionURI[]getUris()Gets the URIs of the correspondingLocalExecutionMessageNotifierwhich is needed to register the listener when starting or resuming via the runtime service.URI[]registerListener(SessionToken session, String sessionId, ExecutionMessageNotification emn) Future<ReplyMessage<?>>registerNotification(String sessionId, long messageId) Registers a notification for the designated session and message ID and returns the corresponding future providing the reply message.booleanreply(ReplyMessage<?> reply) Replies to an execution message with the designated reply.voidunregisterListener(SessionToken session, String sessionId, ExecutionMessageNotification emn)
-
Field Details
-
lemn
The wrapped message notifier. -
waiting
The futures awaited by server notifications indexed by session ID and message ID.
-
-
Constructor Details
-
MessageDemux
Creates a new execution message notifier handling listeners via the designated notifier.- Parameters:
lemn- The notifier for forwarding execution messages for synchronous dispatching to the correspondingExecutionMessageNotification.
-
-
Method Details
-
registerNotification
Registers a notification for the designated session and message ID and returns the corresponding future providing the reply message.- Parameters:
sessionId- The ID of the execution session for which to forward a message to the listener.messageId- The ID of the execution messages which to forward to the listener.- Returns:
- A future for retrieving the reply message to the corresponding execution message.
-
reply
Replies to an execution message with the designated reply. This will set the reply in the corresponding future thus signalling the corresponding notifiers waiting for the reply.- Parameters:
reply- the reply for an execution message sent by a notifier.- Returns:
- Whether the designated reply has been successfully set in the corresponding future.
-
getUris
Gets the URIs of the correspondingLocalExecutionMessageNotifierwhich is needed to register the listener when starting or resuming via the runtime service.- Returns:
- The URIs of the corresponding
LocalExecutionMessageNotifier. - See Also:
-
registerListener
public URI[] registerListener(SessionToken session, String sessionId, ExecutionMessageNotification emn) -
unregisterListener
public void unregisterListener(SessionToken session, String sessionId, ExecutionMessageNotification emn)
-