springspring-integrationmessage-channel

Error when sending bytes through TCP: Unexpected message - no endpoint registered with connection interceptor


I'm trying to rewrite integration.xml in an application to Java Config using DSL. My integration flow goes like this:

  1. Communication object comes to sendCommunication channel
  2. sendCommunication channel is routed into two different channels
  3. objects in each channel are transformed to byte[]
  4. data is logged with custom logger (wire tapped)
  5. bytes from each channel are sent through TCP using two different TcpSendingMessageHandlers

Here's a part of my Integration.java related to this flow (some beans like custom logger are skipped):

@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();
}

I'm getting this error when I'm trying to send data through sendCommunication channel (IPs hidden intentionally):

2016-10-09 19:52:45 WARN TcpNetConnection:186 - Unexpected message - no endpoint registered with connection interceptor: IP:PORT:37007:b2347dad-b65c-4686-b016-5ef5ee613bd5 - GenericMessage [payload=byte[267], headers={ip_tcp_remotePort=PORT, ip_connectionId=IP:PORT:37007:b2347dad-b65c-4686-b016-5ef5ee613bd5, ip_localInetAddress=/LOCAL IP, ip_address=IP, id=c6fb70b1-6d06-a909-cfc4-4eac7c715de5, ip_hostname=IP, timestamp=1476035565330}]

I'd kindly appreciate any help, this error is giving me a headache since yesterday. I couldn't find any explanation myself, google is giving me only this source code on github.


Solution

  • It's just a warning that the an inbound message (reply?) was received from the server to which you sent a message, and there's no inbound channel adapter configured to handle incoming messages.

    Perhaps if you show the XML you are trying to replace with Java config, someone can help.