Class ConsumeContext

java.lang.Object
org.acemq.amqp.api.ConsumeContext

public final class ConsumeContext extends Object
A message about to be handled, as an interceptor sees it.

Read-only, unlike PublishContext. A consume interceptor can observe, refuse, or set up and tear down surrounding state — a log context, a tenant, a transaction — but it cannot rewrite the message on its way in. Rewriting an inbound message would mean the handler no longer sees what the broker delivered, and the difference would show up as a bug in the handler rather than in the interceptor that caused it.

  • Constructor Details

    • ConsumeContext

      public ConsumeContext(String queue, Message<?> message)
      Parameters:
      queue - queue the message arrived on
      message - the decoded message
  • Method Details

    • queue

      public String queue()
      Returns:
      the queue this message arrived on
    • message

      public Message<?> message()
      Returns:
      the decoded message, including its payload
    • envelope

      public Envelope envelope()
      Returns:
      the envelope, a shortcut for message().envelope()
    • toString

      public String toString()
      Overrides:
      toString in class Object