From ceb3daec8ef52e3160176a98c14178358068d0f0 Mon Sep 17 00:00:00 2001 From: abilan Date: Mon, 26 Jun 2023 10:51:36 -0400 Subject: [PATCH] GH-8655: Add channel to JMS samples in doc Fixes https://github.com/spring-projects/spring-integration/issues/8655 In the text about Outbound Channel Adapters for JMS it reads: > The following configuration produces an adapter that receives Spring Integration messages from the `exampleChannel` [...] However, the is no this channel definition in Kotlin and Java DSL snippets * Add an `exampleChannel` to Kotlin and Java DSL samples * Add Groovy DSL sample for the same flow definition --- src/reference/asciidoc/jms.adoc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/reference/asciidoc/jms.adoc b/src/reference/asciidoc/jms.adoc index 58c07fd1d2..c1ccde9a01 100644 --- a/src/reference/asciidoc/jms.adoc +++ b/src/reference/asciidoc/jms.adoc @@ -279,8 +279,8 @@ The following configuration produces an adapter that receives Spring Integration ---- @Bean public IntegrationFlow jmsOutboundFlow() { - return f -> f - .handle(Jms.outboundAdapter(cachingConnectionFactory()) + return IntegrationFlow.from("exampleChannel") + .handle(Jms.outboundAdapter(cachingConnectionFactory()) .destinationExpression("headers." + SimpMessageHeaderAccessor.DESTINATION_HEADER) .configureJmsTemplate(t -> t.id("jmsOutboundFlowTemplate"))); } @@ -290,7 +290,7 @@ public IntegrationFlow jmsOutboundFlow() { ---- @Bean fun jmsOutboundFlow() = - integrationFlow { + integrationFlow("exampleChannel") { handle(Jms.outboundAdapter(jmsConnectionFactory()) .apply { destinationExpression("headers." + SimpMessageHeaderAccessor.DESTINATION_HEADER) @@ -301,6 +301,25 @@ fun jmsOutboundFlow() = ) } ---- +[source, groovy, role="secondary"] +.Groovy DSL +---- +@Bean +jmsOutboundFlow() { + integrationFlow('exampleChannel') { + handle(Jms.outboundAdapter(new ActiveMQConnectionFactory()) + .with { + destinationExpression 'headers.' + SimpMessageHeaderAccessor.DESTINATION_HEADER + deliveryModeFunction { DeliveryMode.NON_PERSISTENT } + timeToLiveExpression '10000' + configureJmsTemplate { + it.explicitQosEnabled true + } + } + ) + } +} +---- [source, java, role="secondary"] .Java ----