我正在尝试使用DSL将应用程序中的integration.xml重写为Java Config。我的整合流程如下:
Communication
对象来到sendCommunication
频道sendCommunication
频道被路由到两个不同的频道byte[]
TcpSendingMessageHandler
s 以下是与此流程相关的Integration.java的一部分(跳过某些bean,如自定义记录器):
@Bean(name = "sendCommunicationRouter")
public IntegrationFlow routeRoundRobin() {
return IntegrationFlows.from(getSendCommunication())
.route(roundRobinRouter, "route",
s -> s.channelMapping("sendCommunication1",
"sendCommunication1")
.channelMapping("sendCommunication2",
"sendCommunication2"))
.get();
}
@Bean(name = "sendCommunication")
public MessageChannel getSendCommunication() {
return getDefaultMessageChannel();
}
@Bean(name = "sendCommunication1")
public MessageChannel getSendCommunication1() {
return getDefaultMessageChannel();
}
@Bean(name = "sendCommunication2")
public MessageChannel getSendCommunication2() {
return getDefaultMessageChannel();
}
@Bean(name = "tcpClientOutbound1")
public TcpSendingMessageHandler getTcpClientOutbound1() {
return getDefaultTcpClientOutbound(getOutboundConnectionFactory1());
}
@Bean(name = "tcpClientOutbound2")
public TcpSendingMessageHandler getTcpClientOutbound2() {
return getDefaultTcpClientOutbound(getOutboundConnectionFactory2());
}
private TcpSendingMessageHandler getDefaultTcpClientOutbound(TcpNetClientConnectionFactory connectionFactory) {
TcpSendingMessageHandler handler = new TcpSendingMessageHandler();
handler.setConnectionFactory(connectionFactory);
handler.setTaskScheduler(myScheduler);
handler.setClientMode(true);
handler.setRetryInterval(DEFAULT_CHANNEL_RETRY_INTERVAL);
handler.start();
return handler;
}
@Bean
public IntegrationFlow handleOutgoingCommunication1() {
return handleOutgoingCommunication(getSendCommunication1(), getTcpClientOutbound1());
}
@Bean
public IntegrationFlow handleOutgoingCommunication2() {
return handleOutgoingCommunication(getSendCommunication2(), getTcpClientOutbound2());
}
private IntegrationFlow handleOutgoingCommunication(MessageChannel inputChannel, TcpSendingMessageHandler handler) {
return IntegrationFlows.from(inputChannel)
.<Communication, byte[]>transform(communication -> communicationTransformer.toBytes(communication))
.wireTap(getLogger())
.handle(handler)
.get();
}
当我尝试通过sendCommunication
频道发送数据时,我收到此错误(故意隐藏IP):
2016-10-09 19:52:45 WARN TcpNetConnection:186 - 意外消息 - 没有使用连接拦截器注册的端点: IP : PORT :37007:b2347dad-b65c-4686-b016-5ef5ee613bd5 - GenericMessage [payload = byte [267],headers = {ip_tcp_remotePort = PORT , ip_connectionId = IP :端口:37007:b2347dad-b65c-4686-b016-5ef5ee613bd5, ip_localInetAddress = / LOCAL IP ,ip_address = IP , id = c6fb70b1-6d06-a909-cfc4-4eac7c715de5,ip_hostname = IP , 时间戳= 1476035565330}]
我很感激任何帮助,这个错误让我从昨天开始头疼。我自己找不到任何解释,谷歌只在github上给我this源代码。
答案 0 :(得分:1)
这只是一个警告,即从您向其发送消息的服务器收到了入站消息(回复?),并且没有配置入站通道适配器来处理传入消息。
也许如果你展示了你试图用Java配置替换的XML,那么有人可以提供帮助。