0

I would like to ask, why amqp / jms is implemented as Inbound and Outbound Channel Adapters.
They role is same as Message Channel, so if they would be implemented as MessageChannel, then it could be easily used in different components e.g. directly in service activator:

<integration:service-activator ref="receiver" method="receiveMessage" input-channel="jmsInputChannel"/>

Where during creation of service activator, it would be mapped to some message listener, that will be called by JMS/AMQP system.
Configuration would be done directly on JMSMessageChannel.

Is there something I missing? Because on high level it does look possible to be done and would simplifiy API.

Dariss
  • 1,258
  • 1
  • 12
  • 27

1 Answers1

1

Looks like you are missing the fact that Spring Integration AMQP and JMS really have particular MesaageChannel implementations

https://docs.spring.io/spring-integration/docs/5.0.0.RELEASE/reference/html/amqp.html#amqp-channels

https://docs.spring.io/spring-integration/docs/5.0.0.RELEASE/reference/html/jms.html#jms-channel

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Yes, I was, thank you :) Can you tell me use case scenarios, where I should use Channel Adapter over Message Channels and the opposite? – Dariss Jan 13 '18 at 22:17
  • When you have a target queue populated by the external system (Inbound) or just send to the target destination and forget (Outbound). You need backed channels to support persistence in between components in your own application or for distribution in the cluster. That’s anti-pattern to use channels only for one way logic – Artem Bilan Jan 13 '18 at 23:51
  • Just to be clear, you should also use the adapters between different spring integration apps. As Artem says, it's ok to use persistence-backed channels to distribute work between instances of the same application but they should not be used to distribute work __between__ aps. – Gary Russell Jan 14 '18 at 19:11
  • I don't understand why is it anti pattern? Message Channel is responsible for moving message from one place to another. Why end of the pipe can't be different application? – Dariss Jan 14 '18 at 19:44
  • 1
    Well, you can, of course, but that’s going to be confusing if you don’t have another side of the pipe in the same app. It’s not clear what is purpose of the channel without one of another part of the pipe – Artem Bilan Jan 14 '18 at 20:42