spring-projects / spring-integration

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)
http://projects.spring.io/spring-integration/
Apache License 2.0
1.55k stars 1.11k forks source link

Configuration samples of a JMS outbound channel adapter #3831

Closed choda closed 2 years ago

choda commented 2 years ago

Not a big issue here, but there is a small discrepancy in the Reference Guide in its current (5.5.13) version, regarding the definition of a JMS Outbound Channel Adapter between XML and Java Config versions.

The XML definition uses the destination parameter to set

the JMS destination reference whose bean name is outQueue

<int-jms:outbound-channel-adapter id="jmsOut" destination="outQueue" channel="exampleChannel"/>

while the Java Config sample uses the destinationName parameter:

@Bean
@ServiceActivator(inputChannel = "exampleChannel")
public MessageHandler jmsOut() {
    JmsSendingMessageHandler handler = new JmsSendingMessageHandler(new JmsTemplate(connectionFactory));
    handler.setDestinationName("outQueue");
    return handler;
}

this will literally write the JMS message in the queue named "outQueue", not in the queue defined in the outQueue bean.

Since the Java DSL/Kotlin DSL samples use the destinationExpression, the "discrepancy" is probably intentional to show all existing variations of how to define the destination, but I'm pointing that one just in case.

artembilan commented 2 years ago

You observation is correct: the intention was really to demonstrate different options for configuring a destination. If you pay attention the XML one even doesn't have a ConnectionFactory. It resolves one from the jmsConnectionFactory bean name.

I made such a discrepancy deliberately to indicate that there are more than just one destination option to configure. I didn't think originally that this can cause some confusion. The other places in this reference even don't have just Java samples, not talking already about DSL and Kotlin.

If you still find this hard digesting, feel free to open Pull Request with possible fix: https://github.com/spring-projects/spring-integration/blob/main/CONTRIBUTING.adoc

Thank you for understanding!

choda commented 2 years ago

That's fine by me. Thanks!