Class AmqpBinding

java.lang.Object
org.mockserver.async.asyncapi.AmqpBinding

public final class AmqpBinding extends Object
Immutable model of the AsyncAPI AMQP 0.9.1 channel binding (channels.<name>.bindings.amqp), carrying the publish-time routing information that AmqpMessagePublisher needs to deliver a message to a RabbitMQ broker.

The AsyncAPI AMQP channel binding distinguishes two channel shapes via its is field:

  • is: routingKey — the channel represents a routing key on an exchange. The channel name is used as the routing key and the exchange is named by exchange.name.
  • is: queue — the channel represents a queue bound to the default exchange. The channel name is the queue name; messages are published to the default exchange ("") with the queue name as the routing key.

Supported binding fields

AMQP binding fields
FieldAsyncAPI locationEffect
isbindings.amqp.is routingKey (exchange-based) or queue (queue-based). Defaults to routingKey.
exchange namebindings.amqp.exchange.name The exchange to publish to (empty string = default exchange).
exchange typebindings.amqp.exchange.type direct/topic/fanout/headers. Used when declaring the exchange.
exchange durablebindings.amqp.exchange.durable Whether a declared exchange is durable. Defaults to true.
queue namebindings.amqp.queue.name The queue to declare/route to (queue-based channels).
queue durablebindings.amqp.queue.durable Whether a declared queue is durable. Defaults to true.
routing keybindings.amqp.routingKey (extension) or the channel name The routing key used when publishing to the exchange.

Deferred

The following AsyncAPI AMQP binding fields are intentionally not applied at publish time and are documented as deferred:
  • exchange.autoDelete, exchange.vhost, queue.exclusive, queue.autoDelete, queue.vhost — topology lifecycle/scoping hints that do not affect a single publish.
  • Operation/message-level AMQP bindings (cc, bcc, deliveryMode, mandatory, replyTo, priority, timestamp, expiration) — message-property level settings.
  • Constructor Details

  • Method Details

    • getChannelType

      public AmqpBinding.ChannelType getChannelType()
    • getExchangeName

      public String getExchangeName()
      The exchange name to publish to, or null when not specified. For a queue-based channel this is typically null (the default exchange is used).
    • getExchangeType

      public String getExchangeType()
      The exchange type (direct/topic/fanout/headers), or null when not specified.
    • isExchangeDurable

      public boolean isExchangeDurable()
    • getQueueName

      public String getQueueName()
      The queue name (queue-based channels), or null when not specified.
    • isQueueDurable

      public boolean isQueueDurable()
    • getRoutingKey

      public String getRoutingKey()
      The explicit routing key from the binding, or null. When null the publisher derives the routing key from the channel name (exchange-based) or queue name (queue-based).
    • toString

      public String toString()
      Overrides:
      toString in class Object