TcpReceivingChannelAdapter vs TcpSendingMessageHandler

偶尔善良 提交于 2019-12-25 01:22:09

问题


Why channel can be set on TcpReceivingChannelAdapter, the inbound adapter, but not on TcpSendingMessageHandler, the outbound adapter?

Why outbound adapter is called TcpSendingMessageHandler, why handler, not adapter?

One would intuitively expects that inbound adapter and outbound adapter would be "mirrors" of each other, just with different directions.

My question is variation of Spring Integration - Inbound vs Outbound Channel Adapters question, but focused on Spring Integration DSL API and Tcp/Ip socket communication.


回答1:


Consuming endpoints (service activator, outbound channel adapter, outbound gateway etc). Consist of two beans, a Consumer (type depends on the channel type) and a message handler.

The channel goes on the consumer which calls the handler when it gets a message.

When using java configuration, the @ServiceActivator annotation triggers the creation of the consumer bean.

If you don't want to use annotations, add a ConsumerEndpointFactoryBean to create the consumer (injecting the handler bean).



来源:https://stackoverflow.com/questions/55163586/tcpreceivingchanneladapter-vs-tcpsendingmessagehandler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!