Class TopologySpec
.topology(t -> t
.exchange("orders", "topic")
.queue("orders.new").quorum()
.boundTo("orders", "order.created"))
One exchange and one queue, deliberately. A workload that fans out across many queues is a different measurement, and combining the two in one spec produces results nobody can attribute — the interesting comparison is several runs, not one run with everything in it.
-
Method Summary
-
Method Details
-
exchange
- Parameters:
name- the exchange to publish to. The default exchange is"", which routes by queue name and skips exchange routing entirely — the fastest path, and not what most systems dotype-topic,direct,fanoutorheaders- Returns:
- this spec
-
queue
- Parameters:
name- the queue to consume from- Returns:
- this spec
-
boundTo
- Parameters:
exchangeName- the exchange to bind tokey- the binding key, which is also the routing key publishes will use- Returns:
- this spec
-
routingKey
- Parameters:
key- the routing key publishes use, when it differs from the binding key- Returns:
- this spec
-
quorum
A quorum queue: replicated, durable, and slower than classic by design.Worth measuring rather than assuming. The throughput difference against a classic queue is large, and it is the price of the guarantee — a comparison run is the honest way to decide whether the guarantee is affordable at your rate.
- Returns:
- this spec
-
classic
- Returns:
- this spec, with a classic queue (the default)
-
argument
- Parameters:
name- a queue argumentvalue- its value- Returns:
- this spec
-
useExisting
Uses the topology as it already exists rather than declaring it.The right choice when measuring a real environment: declaring would either be refused for mismatched arguments or, worse, would create something subtly different from what production runs and measure that instead.
- Returns:
- this spec
-
exchange
-
exchangeType
-
queue
-
routingKey
The key publishes go out with.On the default exchange the routing key is the queue name — that is the whole of how the default exchange routes — so naming a queue and not naming a key has exactly one sensible reading, and it is the queue. Returning the unrelated default instead published every message to a queue of that name, which in general does not exist, and the broker drops an unroutable message on the default exchange without saying anything. Publishers publishing, confirms arriving, queue empty, consumers idle: a run that looks alive and changes nothing. A drill cluster ran that way for a while before anybody noticed.
Only when the key was never set. Someone who writes both a queue and a routing key means both, even on the default exchange where that combination cannot route — and the scenario's own validation refuses that by name rather than it being quietly corrected here.
- Returns:
- the routing key, which on the default exchange defaults to the queue name
-
queueType
-
queueArguments
-
shouldDeclare
public boolean shouldDeclare() -
usesDefaultExchange
public boolean usesDefaultExchange()- Returns:
- whether publishes go through the default exchange
-
toString
-