Skip to content

Commit a9dddae

Browse files
authored
fix(queueType): Leave by default the queueType defined in virtualhost at server level (#150)
* fix(queueType): Leave by default the queueType defined in virtualhost at server level
1 parent b647b77 commit a9dddae

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

async/async-rabbit/src/main/java/org/reactivecommons/async/rabbit/communications/TopologyCreator.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class TopologyCreator {
2424

2525
public TopologyCreator(Sender sender, String queueType) {
2626
this.sender = sender;
27-
this.queueType = queueType != null ? queueType : "classic";
27+
this.queueType = queueType;
2828
}
2929

3030
public Mono<AMQP.Exchange.DeclareOk> declare(ExchangeSpecification exchange) {
@@ -90,14 +90,17 @@ public Mono<AMQP.Queue.DeclareOk> declareQueue(String name, Optional<Integer> ma
9090

9191
protected QueueSpecification fillQueueType(QueueSpecification specification) {
9292
String resolvedQueueType = this.queueType;
93-
if (specification.isAutoDelete() || specification.isExclusive()) {
93+
if ("quorum".equals(resolvedQueueType)
94+
&& (specification.isAutoDelete() || specification.isExclusive())) {
9495
resolvedQueueType = "classic";
9596
}
9697
Map<String, Object> args = specification.getArguments();
9798
if (args == null) {
9899
args = new HashMap<>();
99100
}
100-
args.put("x-queue-type", resolvedQueueType);
101+
if (resolvedQueueType != null) {
102+
args.put("x-queue-type", resolvedQueueType);
103+
}
101104
specification.arguments(args);
102105
return specification;
103106
}

docs/docs/reactive-commons/9-configuration-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ app:
3131
enabled: true # if you want to disable this domain you can set it to false
3232
mandatory: false # if you want to enable mandatory messages, you can set it to true, this will throw an exception if the message cannot be routed to any queue
3333
brokerType: "rabbitmq" # please don't change this value
34-
queueType: classic # you can change the queue type to 'quorum' if your RabbitMQ cluster supports it
34+
queueType: null # you can set to 'classic' or to 'quorum' if your RabbitMQ cluster supports it, by default it will take the virtual host default queue type
3535
flux:
3636
maxConcurrency: 250 # max concurrency of listener flow
3737
domain:

starters/async-rabbit-starter/src/main/java/org/reactivecommons/async/rabbit/config/props/AsyncProps.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,6 @@ public class AsyncProps extends GenericAsyncProps<RabbitProperties> {
7676
private String brokerType = "rabbitmq";
7777

7878
@Builder.Default
79-
private String queueType = "classic"; // or "quorum"
79+
private String queueType = null; // "classic" or "quorum"
8080

8181
}

0 commit comments

Comments
 (0)