public final class QueueBuilder extends AbstractBuilder
Modifier and Type | Class and Description |
---|---|
static class |
QueueBuilder.MasterLocator |
static class |
QueueBuilder.Overflow |
Modifier and Type | Method and Description |
---|---|
QueueBuilder |
autoDelete()
The final queue will auto delete.
|
Queue |
build()
Builds a final queue.
|
QueueBuilder |
deadLetterExchange(String dlx)
Set the dead-letter exchange to which to route expired or rejected messages.
|
QueueBuilder |
deadLetterRoutingKey(String dlrk)
Set the routing key to use when routing expired or rejected messages to the
dead-letter exchange.
|
QueueBuilder |
deliveryLimit(int limit)
Set the delivery limit; only applies to quorum queues.
|
static QueueBuilder |
durable()
Creates a builder for a durable queue with a generated
unique name -
spring.gen-<random> . |
static QueueBuilder |
durable(String name)
Creates a builder for a durable queue.
|
QueueBuilder |
exclusive()
The final queue will be exclusive.
|
QueueBuilder |
expires(int expires)
Set the time that the queue can remain unused before being deleted.
|
QueueBuilder |
lazy()
Set the queue into lazy mode, keeping as many messages as possible on disk to
reduce RAM usage on the broker.
|
QueueBuilder |
masterLocator(QueueBuilder.MasterLocator locator)
Set the master locator mode which determines which node a queue master will be
located on a cluster of nodes.
|
QueueBuilder |
maxLength(int count)
Set the number of (ready) messages allowed in the queue before it starts to drop
them.
|
QueueBuilder |
maxLengthBytes(int bytes)
Set the total aggregate body size allowed in the queue before it starts to drop
them.
|
QueueBuilder |
maxPriority(int maxPriority)
Set the maximum number if priority levels for the queue to support; if not set, the
queue will not support message priorities.
|
static QueueBuilder |
nonDurable()
Creates a builder for a non-durable (transient) queue.
|
static QueueBuilder |
nonDurable(String name)
Creates a builder for a non-durable (transient) queue.
|
QueueBuilder |
overflow(QueueBuilder.Overflow overflow)
Set the overflow mode when messages are dropped due to max messages or max message
size is exceeded.
|
QueueBuilder |
quorum()
Set the queue argument to declare a queue of type 'quorum' instead of 'classic'.
|
QueueBuilder |
singleActiveConsumer()
Set the 'x-single-active-consumer' queue argument.
|
QueueBuilder |
ttl(int ttl)
Set the message time-to-live after which it will be discarded, or routed to the
dead-letter-exchange, if so configured.
|
QueueBuilder |
withArgument(String key,
Object value)
The final queue will contain argument used to declare a queue.
|
QueueBuilder |
withArguments(Map<String,Object> arguments)
The final queue will contain arguments used to declare a queue.
|
getArguments, getOrCreateArguments
public static QueueBuilder durable()
spring.gen-<random>
.public static QueueBuilder nonDurable()
public static QueueBuilder durable(String name)
name
- the name of the queue.public static QueueBuilder nonDurable(String name)
name
- the name of the queue.public QueueBuilder exclusive()
public QueueBuilder autoDelete()
public QueueBuilder withArgument(String key, Object value)
key
- argument namevalue
- argument valuepublic QueueBuilder withArguments(Map<String,Object> arguments)
arguments
- the arguments mappublic QueueBuilder ttl(int ttl)
ttl
- the time to live (milliseconds).deadLetterExchange(String)
public QueueBuilder expires(int expires)
expires
- the expiration (milliseconds).public QueueBuilder maxLength(int count)
count
- the number of (ready) messages allowed.overflow(Overflow)
public QueueBuilder maxLengthBytes(int bytes)
bytes
- the total aggregate body size.public QueueBuilder overflow(QueueBuilder.Overflow overflow)
overflow
- QueueBuilder.Overflow.dropHead
or QueueBuilder.Overflow.rejectPublish
.public QueueBuilder deadLetterExchange(String dlx)
dlx
- the dead-letter exchange.deadLetterRoutingKey(String)
public QueueBuilder deadLetterRoutingKey(String dlrk)
dlrk
- the dead-letter routing key.deadLetterExchange(String)
public QueueBuilder maxPriority(int maxPriority)
maxPriority
- the maximum priority.public QueueBuilder lazy()
public QueueBuilder masterLocator(QueueBuilder.MasterLocator locator)
locator
- QueueBuilder.MasterLocator.minMasters
, QueueBuilder.MasterLocator.clientLocal
or QueueBuilder.MasterLocator.random
.public QueueBuilder singleActiveConsumer()
public QueueBuilder quorum()
public QueueBuilder deliveryLimit(int limit)
limit
- the limit.quorum()
public Queue build()