Class MessageUtils
java.lang.Object
org.springframework.pulsar.reactive.support.MessageUtils
Convenience functions related to Spring
messages.- Author:
- Chris Bono
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.apache.pulsar.reactive.client.api.MessageResult<Void>acknowledge(Message<T> message) Convenience method that acknowledges a Spring message byextractingits message id and passing it toMessageResult.acknowledge(MessageId).static <T> org.apache.pulsar.client.api.MessageIdextractMessageId(Message<T> message) Determine the PulsarMessageIdfor a given Spring message by extracting the value of itsPulsarHeaders.MESSAGE_IDheader.static <T> org.apache.pulsar.reactive.client.api.MessageResult<Void>negativeAcknowledge(Message<T> message) Convenience method that negatively acknowledges a Spring message byextractingits message id and passing it toMessageResult.negativeAcknowledge(MessageId).
-
Method Details
-
extractMessageId
Determine the PulsarMessageIdfor a given Spring message by extracting the value of itsPulsarHeaders.MESSAGE_IDheader.- Type Parameters:
T- the type of message payload- Parameters:
message- the Spring message- Returns:
- the Pulsar message id
- Throws:
IllegalStateException- if the message id could not be determined
-
acknowledge
public static <T> org.apache.pulsar.reactive.client.api.MessageResult<Void> acknowledge(Message<T> message) Convenience method that acknowledges a Spring message byextractingits message id and passing it toMessageResult.acknowledge(MessageId).- Type Parameters:
T- the type of message payload- Parameters:
message- the Spring message to acknowledge- Returns:
- an empty value and signals that the message must be acknowledged
-
negativeAcknowledge
public static <T> org.apache.pulsar.reactive.client.api.MessageResult<Void> negativeAcknowledge(Message<T> message) Convenience method that negatively acknowledges a Spring message byextractingits message id and passing it toMessageResult.negativeAcknowledge(MessageId).- Type Parameters:
T- the type of message payload- Parameters:
message- the Spring message to negatively acknowledge- Returns:
- an empty value and signals that the message must be negatively acknowledged
-