From cdba9a741c5d27c9df35bebfe5bd6e497b3fa9b0 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Fri, 27 Jul 2018 10:21:14 -0400 Subject: [PATCH] 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** --- .../jms/dsl/JmsListenerContainerSpec.java | 15 ++++++++++++++- .../integration/jms/dsl/JmsTests.java | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsListenerContainerSpec.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsListenerContainerSpec.java index a28f76ece9..a0df78825c 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsListenerContainerSpec.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/dsl/JmsListenerContainerSpec.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.util.ErrorHandler; * * @author Artem Bilan * @author Gary Russell + * * @since 5.0 */ public class JmsListenerContainerSpec, C extends AbstractMessageListenerContainer> @@ -93,6 +94,18 @@ public class JmsListenerContainerSpec, return _this(); } + /** + * Set whether to make the subscription shared. + * @param subscriptionShared make the subscription shared or not. + * @return the spec. + * @since 5.0.7 + * @see AbstractMessageListenerContainer#setSubscriptionShared(boolean) + */ + public S subscriptionShared(boolean subscriptionShared) { + this.target.setSubscriptionShared(subscriptionShared); + return _this(); + } + /** * @param exceptionListener the exceptionListener. * @return the spec. diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java index 83b431707b..1f961016dc 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/dsl/JmsTests.java @@ -417,6 +417,8 @@ public class JmsTests { .destination("jmsMessageDrivenRedelivery") .configureListenerContainer(c -> c .transactionManager(mock(PlatformTransactionManager.class)) + .subscriptionDurable(false) + .subscriptionShared(false) .id("jmsMessageDrivenRedeliveryFlowContainer"))) .transform(p -> { throw new RuntimeException("intentional");