ExecutorSubscribableChannel that ensures messages
are processed in the order they were published to the channel. Messages are
sent one at a time with the next one released when the previous has been
processed. This decorator is intended to be applied per session.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private class | OrderedMessageChannelDecorator.
Remove handled message from queue, and send next message. |
| Modifier and Type | Field and Description |
|---|---|
| private final MessageChannel | |
| private final Log | |
| private final Queue | |
| private static final String | |
| private final AtomicBoolean | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static void | configureInterceptor(MessageChannel
the channel to configure channel, boolean whether preserve the order or publication; when
"true" an interceptor is inserted, when "false" it removed. preserveOrder)Install or remove an |
| public static Runnable | |
| private boolean | removeMessage(Message<?> message)
Remove the message from the top of the queue, but only if it matches, i.e. hasn't been removed already. |
| public boolean | send(Message<?>
the message to send message)Overrides default org. Send a |
| public boolean | send(Message<?>
the message to send message, long the timeout in milliseconds or timeout)INDEFINITE_TIMEOUTImplements org. Send a message, blocking until either the message is accepted or the specified timeout period elapses. |
| private void | |
| private static void | |
| public static boolean | supportsOrderedMessages(MessageChannel channel)
Whether the channel has been |
| private void |
| channel | back to summary |
|---|---|
| private final MessageChannel channel | |
| logger | back to summary |
|---|---|
| private final Log logger | |
| messages | back to summary |
|---|---|
| private final Queue<Message<?>> messages | |
| NEXT_MESSAGE_TASK_HEADER | back to summary |
|---|---|
| private static final String NEXT_MESSAGE_TASK_HEADER | |
| sendInProgress | back to summary |
|---|---|
| private final AtomicBoolean sendInProgress | |
| subscriberCount | back to summary |
|---|---|
| private final int subscriberCount | |
| OrderedMessageChannelDecorator | back to summary |
|---|---|
| public OrderedMessageChannelDecorator(MessageChannel channel, Log logger) | |
| configureInterceptor | back to summary |
|---|---|
| public static void configureInterceptor(MessageChannel channel, boolean preserveOrder) Install or remove an
| |
| getNextMessageTask | back to summary |
|---|---|
| public static Runnable getNextMessageTask(Message<?> message) Obtain the task to release the next message, if found.
| |
| removeMessage | back to summary |
|---|---|
| private boolean removeMessage(Message<?> message) Remove the message from the top of the queue, but only if it matches, i.e. hasn't been removed already. | |
| send | back to summary |
|---|---|
| public boolean send(Message<?> message) Overrides default org. Doc from org. Send a This method may block indefinitely, depending on the implementation.
To provide a maximum wait time, use | |
| send | back to summary |
|---|---|
| public boolean send(Message<?> message, long timeout) Implements org. Doc from org. Send a message, blocking until either the message is accepted or the specified timeout period elapses.
| |
| sendNextMessage | back to summary |
|---|---|
| private void sendNextMessage() | |
| setTaskHeader | back to summary |
|---|---|
| private static void setTaskHeader(Message<?> message, Runnable task) | |
| supportsOrderedMessages | back to summary |
|---|---|
| public static boolean supportsOrderedMessages(MessageChannel channel) Whether the channel has been
| |
| trySend | back to summary |
|---|---|
| private void trySend() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterMessageHandled(Message<?>
the message handled message, MessageChannel the channel on which the message was sent to ch, MessageHandler the target handler that handled the message handler, Exception any exception that may have been raised by the handler ex)Overrides default org. Invoked inside the |
| CallbackTaskInterceptor | back to summary |
|---|---|
| private CallbackTaskInterceptor() | |
| afterMessageHandled | back to summary |
|---|---|
| public void afterMessageHandled(Message<?> message, MessageChannel ch, MessageHandler handler, Exception ex) Overrides default org. Doc from org. Invoked inside the Note that this will be invoked only if beforeHandle successfully completed
and returned a Message, i.e. it did not return
| |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicInteger | |
| private final Message |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| handledCount | back to summary |
|---|---|
| private final AtomicInteger handledCount
| |
| message | back to summary |
|---|---|
| private final Message<?> message | |
| PostHandleTask | back to summary |
|---|---|
| private PostHandleTask(Message<?> message) | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |