Class IncomingRabbitMQMessage<T>

java.lang.Object
io.smallrye.reactive.messaging.rabbitmq.IncomingRabbitMQMessage<T>
Type Parameters:
T - the message body type
All Implemented Interfaces:
ContextAwareMessage<T>, MetadataInjectableMessage<T>, org.eclipse.microprofile.reactive.messaging.Message<T>

public class IncomingRabbitMQMessage<T> extends Object implements ContextAwareMessage<T>, MetadataInjectableMessage<T>
An implementation of Message suitable for incoming RabbitMQ messages.
  • Field Details

    • message

      public final io.vertx.rabbitmq.RabbitMQMessage message
    • metadata

      protected org.eclipse.microprofile.reactive.messaging.Metadata metadata
    • rabbitMQMetadata

      protected final IncomingRabbitMQMetadata rabbitMQMetadata
  • Constructor Details

  • Method Details

    • getAckWithMetadata

      public Function<org.eclipse.microprofile.reactive.messaging.Metadata,CompletionStage<Void>> getAckWithMetadata()
      Specified by:
      getAckWithMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • getNackWithMetadata

      public BiFunction<Throwable,org.eclipse.microprofile.reactive.messaging.Metadata,CompletionStage<Void>> getNackWithMetadata()
      Specified by:
      getNackWithMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • ack

      public CompletionStage<Void> ack(org.eclipse.microprofile.reactive.messaging.Metadata metadata)
      Specified by:
      ack in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • nack

      public CompletionStage<Void> nack(Throwable reason, org.eclipse.microprofile.reactive.messaging.Metadata metadata)
      Specified by:
      nack in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • acknowledgeMessage

      public void acknowledgeMessage()
      Acknowledges the message.
    • rejectMessage

      public void rejectMessage(Throwable reason)
      Rejects the message by nack'ing with requeue=false; this will either discard the message for good or (if a DLQ has been set up) send it to the DLQ.
      Parameters:
      reason - the cause of the rejection, which must not be null
    • rejectMessage

      public void rejectMessage(Throwable reason, boolean requeue)
      Rejects the message by nack'ing it.

      This will either discard the message for good, requeue (if requeue=true is set) or (if a DLQ has been set up) send it to the DLQ.

      Please note that requeue is potentially dangerous as it can lead to very high load if all consumers reject and requeue a message repeatedly.

      Parameters:
      reason - the cause of the rejection, which must not be null
      requeue - the requeue flag
    • getPayload

      public T getPayload()
      Specified by:
      getPayload in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • getMetadata

      public org.eclipse.microprofile.reactive.messaging.Metadata getMetadata()
      Specified by:
      getMetadata in interface org.eclipse.microprofile.reactive.messaging.Message<T>
    • getHeaders

      public Map<String,Object> getHeaders()
    • getContentType

      public Optional<String> getContentType()
    • getContentEncoding

      public Optional<String> getContentEncoding()
    • getDeliveryMode

      public Optional<Integer> getDeliveryMode()
    • getPriority

      public Optional<Integer> getPriority()
    • getCorrelationId

      public Optional<String> getCorrelationId()
    • getReplyTo

      public Optional<String> getReplyTo()
    • getExpiration

      public Optional<String> getExpiration()
    • getMessageId

      public Optional<String> getMessageId()
    • getTimestamp

      public Optional<ZonedDateTime> getTimestamp(ZoneId zoneId)
    • getType

      public Optional<String> getType()
    • getUserId

      public Optional<String> getUserId()
    • getAppId

      public Optional<String> getAppId()
    • getCreationTime

      @Deprecated public Optional<ZonedDateTime> getCreationTime(ZoneId zoneId)
      Deprecated.
      Use getTimestamp()
    • getRabbitMQMessage

      public io.vertx.mutiny.rabbitmq.RabbitMQMessage getRabbitMQMessage()
    • injectMetadata

      public void injectMetadata(Object metadataObject)
      Specified by:
      injectMetadata in interface MetadataInjectableMessage<T>