TcpConnection包装拦截器发布其连接工厂属性未知的TcpConnectionOpenEvent

时间:2018-01-13 08:26:00

标签: java spring tcp spring-integration

我在下面创建了一个小型Tcp通信应用程序。

si_tcp_sample

它基于TCP Sample in spring-integration-samples。网关生成的消息由出站网关通过TCP发送到入站通道适配器。反过来,出站通道适配器回应响应通过TCP返回。这个应用程序有两个TcpNetClientConnectionFactories,一个是设置拦截器工厂链而另一个不是。 运行此应用程序,输出如下所示的日志。

TcpConnectionOpenEvent with TcpConnection wrapped Interceptor↓
16:50:01.411 [main] DEBUG com.neriudon.example.tcp.listener.TcpConnectionEventsListener - ★OPEN★ TcpConnectionOpenEvent [source=SimpleInterceptor:null], [factory=unknown, connectionId=localhost:50001:64609:627f6eb5-401f-44e2-88a9-4f966ee66092] **OPENED** 

TcpConnectionOpenEvent with raw TcpConnection↓
16:50:01.426 [main] DEBUG com.neriudon.example.tcp.listener.TcpConnectionEventsListener - ★OPEN★ TcpConnectionOpenEvent [source=TcpNetConnection:localhost:50002:64610:ee9b0bcd-aa9a-4fdb-9194-2e761caabed6], [factory=client2, connectionId=localhost:50002:64610:ee9b0bcd-aa9a-4fdb-9194-2e761caabed6] **OPENED** 

TcpConnection包装拦截器发布TcpConnectionOpenEvent,其连接工厂属性为" unknown"。我认为这个连接工厂属性应该是" client1"。这是为什么? (Spring Integration的版本是4.3.12。)

从这里编辑

其他TcpConnectionEvents'连接工厂属性似乎正确。 例如,TcpConnectionCloseEvent日志在下面。

TcpConnectionCloseEvent with TcpConnection wrapped Interceptor↓
20:26:54.009 [main] DEBUG com.neriudon.example.tcp.listener.TcpConnectionEventsListener - ★CLOSE★ TcpConnectionCloseEvent [source=TcpNetConnection:localhost:50001:53828:ec63181f-3db1-478b-8a38-160a431a8887], [factory=client1, connectionId=localhost:50001:53828:ec63181f-3db1-478b-8a38-160a431a8887] **CLOSED** 

TcpConnectionCloseEvent with raw TcpConnection↓
20:26:54.021 [main] DEBUG com.neriudon.example.tcp.listener.TcpConnectionEventsListener - ★CLOSE★ TcpConnectionCloseEvent [source=TcpNetConnection:localhost:50002:53829:4e02e3cc-7eb8-4e5d-a41a-2e6ff99518aa], [factory=client2, connectionId=localhost:50002:53829:4e02e3cc-7eb8-4e5d-a41a-2e6ff99518aa] **CLOSED** 

1 个答案:

答案 0 :(得分:0)

这是一个错误;连接工厂名称不会传播到拦截器。

open a JIRA Issue