basil daniel
basil daniel

Reputation: 1

Netty IdleStateHandler with Camel RouteBuilder

I am developing a TCP Server using Springboot Camel netty to receive messages from IoT devices. I need to implement close connections that are idle for 10 minutes. Can someone guide me on configuring IdleStateHandler in RouteBuilder?.

public class TcpServerRoute extends RouteBuilder {

private static final Logger appLog = LoggerFactory.getLogger(TcpServerRoute.class);

@Autowired
private MessageProcessor customMessageProcessor;

@Override
public void configure() throws Exception {

    try {
        from("netty:tcp://{{tcp.allowed.ips}}:{{tcp.port}}"
                + "?serverExceptionCaughtLogLevel=OFF&sync=true"
                + "&keepAlive={{tcp.keepAlive}}&requestTimeout={{tcp.requestTimeout}}")
            .routeConfigurationId("tcpServerRoute")
            .process(customMessageProcessor)
            .transform().simple("${body}")  
            .to("log:received-tcp");
    } catch (Exception exception) {
        appLog.error("Error occured while performing the tcp operation:{} ",
                exception.getMessage(), exception);
    }
}
}

Upvotes: 0

Views: 21

Answers (0)

Related Questions