Package org.eclipse.hono.util
Class MessageTap
- java.lang.Object
-
- org.eclipse.hono.util.MessageTap
-
- All Implemented Interfaces:
Consumer<org.apache.qpid.proton.message.Message>
public final class MessageTap extends Object implements Consumer<org.apache.qpid.proton.message.Message>
A consumer that inspects a received message to detect if it indicates that a device should be currently ready to receive an upstream message. Depending on the outcome the passed callbacks are invoked (effectively implementing a tap).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(org.apache.qpid.proton.message.Message msg)
static Consumer<org.apache.qpid.proton.message.Message>
getConsumer(Consumer<org.apache.qpid.proton.message.Message> messageConsumer, Consumer<TimeUntilDisconnectNotification> notificationReadyToDeliverConsumer)
Construct a message consumer that detects an indication that a device is ready to receive an upstream message and delegates to the passed callback handlers.
-
-
-
Method Detail
-
getConsumer
public static Consumer<org.apache.qpid.proton.message.Message> getConsumer(Consumer<org.apache.qpid.proton.message.Message> messageConsumer, Consumer<TimeUntilDisconnectNotification> notificationReadyToDeliverConsumer)
Construct a message consumer that detects an indication that a device is ready to receive an upstream message and delegates to the passed callback handlers.- Parameters:
messageConsumer
- Message consumer that handles generic messages.notificationReadyToDeliverConsumer
- Consumer<TimeUntilDisconnectNotification> that is called when the message indicates the current readiness to receive an upstream message.- Returns:
- The message consumer that invokes the specific handlers depending on the event type.
- Throws:
NullPointerException
- if any of the parameters arenull
.
-
-