JMS-in-gateway: destination to requestDestination (#3494)

* JMS-in-gateway: destination to requestDestination

Related to https://stackoverflow.com/questions/66174779/what-is-the-dsl-version-of-int-jmsinbound-gateway-request-destination

In Java DSL, the `JmsInboundGatewaySpec` expose a `destination()` option which is not correlated
what we have in XML with a `request-destination` and what we have with a `replyQueue` option

* Deprecate an existing `destination()` option in the `JmsInboundGatewaySpec`
in favor of newly introduced `requestDestination()`
* Clean up a bit `jms.adoc` and add some code block-switch sections to show
Java & Kotlin DSLs along side with existing XML configs

* Fix typo.

Co-authored-by: Gary Russell <grussell@vmware.com>
This commit is contained in:
Artem Bilan
2021-02-16 17:08:24 -05:00
committed by GitHub
parent b1cb9069fe
commit aeb43f3069
3 changed files with 169 additions and 28 deletions

View File

@@ -197,7 +197,8 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
* @param <S> the target {@link JmsListenerContainerSpec} implementation type.
* @param <C> the target {@link AbstractMessageListenerContainer} implementation type.
*/
public static class JmsInboundGatewayListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
public static class JmsInboundGatewayListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>,
C extends AbstractMessageListenerContainer>
extends JmsInboundGatewaySpec<JmsInboundGatewayListenerContainerSpec<S, C>> {
private final S spec;
@@ -212,9 +213,22 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
* @param destination the destination
* @return the spec.
* @see JmsListenerContainerSpec#destination(Destination)
* @deprecated since 5.5 in favor of {@link #requestDestination(Destination)}
*/
@Deprecated
public JmsInboundGatewayListenerContainerSpec<S, C> destination(Destination destination) {
this.spec.destination(destination);
return requestDestination(destination);
}
/**
* Specify a request destination for incoming messages.
* @param requestDestination the destination
* @return the spec.
* @see JmsListenerContainerSpec#destination(Destination)
* @since 5.5
*/
public JmsInboundGatewayListenerContainerSpec<S, C> requestDestination(Destination requestDestination) {
this.spec.destination(requestDestination);
return _this();
}
@@ -222,14 +236,32 @@ public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
* @param destinationName the destinationName
* @return the spec.
* @see JmsListenerContainerSpec#destination(String)
* @deprecated since 5.5 in favor of {@link #requestDestination(String)}
*/
@Deprecated
public JmsInboundGatewayListenerContainerSpec<S, C> destination(String destinationName) {
this.spec.destination(destinationName);
return requestDestination(destinationName);
}
/**
* Specify a request destination for incoming messages.
* @param requestDestinationName the destination name
* @return the spec.
* @see JmsListenerContainerSpec#destination(String)
* @since 5.5
*/
public JmsInboundGatewayListenerContainerSpec<S, C> requestDestination(String requestDestinationName) {
this.spec.destination(requestDestinationName);
return _this();
}
public JmsInboundGatewayListenerContainerSpec<S, C> configureListenerContainer(
Consumer<S> configurer) {
/**
* Specify a {@link Consumer} to accept a {@link JmsListenerContainerSpec} for further configuration.
* @param configurer the {@link Consumer} to accept a {@link JmsListenerContainerSpec}
* for further configuration.
* @return the spec
*/
public JmsInboundGatewayListenerContainerSpec<S, C> configureListenerContainer(Consumer<S> configurer) {
Assert.notNull(configurer, "'configurer' must not be null");
configurer.accept(this.spec);
return _this();

View File

@@ -444,7 +444,7 @@ public class JmsTests extends ActiveMQMultiContextTests {
}
}))
.destination("jmsPipelineTest")
.requestDestination("jmsPipelineTest")
.configureListenerContainer(c ->
c.transactionManager(mock(PlatformTransactionManager.class))))
.filter(payload -> !"junk".equals(payload))