How can I detect network disconnection in Apache Camel?

前端 未结 2 2019
心在旅途
心在旅途 2021-01-28 20:34

I need to log when a client is disconnected from Apache Camel connection. How can I detect a netty-tcp disconnection?

    from(\"{{uri.client.address}}\")
         


        
2条回答
  •  梦如初夏
    2021-01-28 21:04

    Use an ErrorHandler, e.g. the LoggingErrorHandler:

    RouteBuilder builder = new RouteBuilder() {
        public void configure() {
            // use logging error handler
            errorHandler(loggingErrorHandler("com.mycompany.foo"));
    
            // here is our regular route
            from("{{uri.client.address}}").to("mock:out");
        }
    }; 
    

提交回复
热议问题