Skip to content

Commit cdba9a7

Browse files
artembilangaryrussell
authored andcommitted
INT-4512: Add more JMS options for DSL builders
JIRA: https://jira.spring.io/browse/INT-4512 * Add `JmsListenerContainerSpec.subscriptionShared()` option **Cherry-pick to 5.0.x**
1 parent c44cd2b commit cdba9a7

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsListenerContainerSpec.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 the original author or authors.
2+
* Copyright 2016-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
*
3232
* @author Artem Bilan
3333
* @author Gary Russell
34+
*
3435
* @since 5.0
3536
*/
3637
public class JmsListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
@@ -93,6 +94,18 @@ public S durableSubscriptionName(String durableSubscriptionName) {
9394
return _this();
9495
}
9596

97+
/**
98+
* Set whether to make the subscription shared.
99+
* @param subscriptionShared make the subscription shared or not.
100+
* @return the spec.
101+
* @since 5.0.7
102+
* @see AbstractMessageListenerContainer#setSubscriptionShared(boolean)
103+
*/
104+
public S subscriptionShared(boolean subscriptionShared) {
105+
this.target.setSubscriptionShared(subscriptionShared);
106+
return _this();
107+
}
108+
96109
/**
97110
* @param exceptionListener the exceptionListener.
98111
* @return the spec.

spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ public IntegrationFlow jmsMessageDrivenRedeliveryFlow() {
417417
.destination("jmsMessageDrivenRedelivery")
418418
.configureListenerContainer(c -> c
419419
.transactionManager(mock(PlatformTransactionManager.class))
420+
.subscriptionDurable(false)
421+
.subscriptionShared(false)
420422
.id("jmsMessageDrivenRedeliveryFlowContainer")))
421423
.<String, String>transform(p -> {
422424
throw new RuntimeException("intentional");

0 commit comments

Comments
 (0)