TcpReceivingChannelAdapter vs TcpSendingMessageHan

2019-08-17 08:24发布

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条回答
Deceive 欺骗
2楼-- · 2019-08-17 09:09

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).

查看更多
登录 后发表回答