为什么 Apache Camel 导致正常关闭

问题描述

您好,我有一个用 Kotlin 编写并使用 Spring boot Framework 和 Apache Camel 的应用程序: https://camel.apache.org/components/latest/smpp-component.html#_spring_boot_auto_configuration

所以我是 Smpp 协议的新手,我想尝试连接到 SMC 模拟器,所以我猜我的 在这种情况下,当我运行应用程序时,“客户端”应该等待来自 SMC 的消息 似乎只是停止和了。当它停止时,我会认为有什么问题。

   @Bean
    fun camelContextConfiguration(): CamelContextConfiguration{
        return object : CamelContextConfiguration {
            override fun afterApplicationStart(camelContext: CamelContext?) {
                logger.info("*********************************************************************************")
                //var query : Query?
                //val oldRoute : List<Route> = camelContext!!.routes
                camelContext!!.routes
                //logger.info("Old Routes")
                //logger.info(oldRoute.size.toString())
//                for(route:Route in oldRoute) {
//                    logger.info("Route with routeId {} is deleted",route.id)
//                    camelContext.stopRoute(route.id)
//                    camelContext.removeRoute(route.id)
//                }
                camelContext.isUseMDCLogging=true
                logger.info("ROUTES")
                    val routeDefinition = RouteDefinition()
                    routeDefinition.id="1"
                   routeDefinition.onException(Exception::class.java).handled(true)
                           .process(exceptionProcessor())
                           .end()
                   
                    routeDefinition.from("smpp://smppclient@smscsim.melroselabs.com:2775?password=password&enquireLinkTimer=3000&transactionTimer=5000&systemId=145244&systemType='Receiver'")
                    routeDefinition.to("log:com.app.smppdispenser.infraestructure.smpp?showBody=true&showHeaders=true")
                    routeDefinition.process(messageProcessor())
                    camelContext.addRouteDefinition(routeDefinition)
                   //routeDefinition.setHeader("CamelSmppCommandId",constant("query_sm"))
                    //routeDefinition.setHeader("CamelSmppSequenceNumber",constant("1"))
                    logger.info("Route is added with routeId {} ",routeDefinition.id)

                //}
                logger.info("CamelConfiguration afterApplicationStart OK")
            }
            override fun beforeApplicationStart(camelContext: CamelContext?) {
                logger.info("CamelConfiguration beforeApplicationStart")
            }

        }
    }

这是日志>

2021-06-06 10:37:06.824 INFO 5604 --- [主要] o.a.c.s.boot.CamelContextConfiguration:路线 2021-06-06 10:37:07.538 信息 5604 --- [主要] org.jsmpp.session.SMPPSession : 连接到 smscsim.melroselabs.com/18.200.51.80 2021-06-06 10:37:07.541 信息 5604 --- [ession@31859960] org.jsmpp.session.SMPPSession : 启动 PDUReaderWorker 2021-06-06 10:37:07.817 INFO 5604 --- [
main] org.jsmpp.session.SMPPSession :其他方面的报告 SMPP 接口版本 34 2021-06-06 10:37:07.817 INFO 5604 --- [
main] org.jsmpp.session.SMPPSession : 改变处理器 度到 3 2021-06-06 10:37:07.819 INFO 5604 --- [主要] o.a.camel.component.smpp.SmppConsumer:连接到: smpp://145244@smscsim.melroselabs.com:2775 2021-06-06 10:37:07.820 信息 5604 --- [主要] o.a.camel.spring.SpringCamelContext
: 路线: 1 开始并消耗: smpp://smppclient@smscsim.melroselabs.com:2775?enquireLinkTimer=3000&password=xxxxxx&systemId=145244&systemType=%27Receiver%27&transactionTimer=5000 2021-06-06 10:37:07.821 信息 5604 --- [主要] o.a.c.s.boot.CamelContextConfiguration : Route 添加了 routeId 1 2021-06-06 10:37:07.821 INFO 5604 --- [主要] o.a.c.s.boot.CamelContextConfiguration : CamelConfiguration afterApplicationStart OK 2021-06-06 10:37:07.936 INFO 5604 --- [
Thread-2] o.s.w.c.s.GenericWebApplicationContext : 关闭 org.springframework.web.context.support.GenericWebApplicationContext@2cf3d63b: 启动日期 [Sun Jun 06 10:36:55 COT 2021];上下文层次结构的根 2021-06-06 10:37:07.944 INFO 5604 --- [ Thread-2] o.s.c.support.DefaultLifecycleProcessor :在阶段停止bean 2147483647 2021-06-06 10:37:07.945 INFO 5604 --- [ Thread-2] o.a.camel.spring.SpringCamelContext:Apache Camel 2.20.1 (CamelContext: camel-1) 正在关闭 2021-06-06 10:37:07.946 INFO 5604 --- [线程2] o.a.camel.impl.DefaultShutdownStrategy : 开始正常关闭 1 条路由(超时 300 秒) 2021-06-06 10:37:08.163 警告 5604 --- [ession@31859960] org.jsmpp.session.SMPPSession : IOException 阅读时: 套接字关闭 2021-06-06 10:37:08.164 INFO 5604 --- [- ShutdownTask] o.a.camel.component.smpp.SmppConsumer:断开连接: smpp://145244@smscsim.melroselabs.com:2775 2021-06-06 10:37:08.164 信息 5604 --- [- ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy : 路线: 1 关闭完成,正在消耗: smpp://smppclient@smscsim.melroselabs.com:2775?enquireLinkTimer=3000&password=xxxxxx&systemId=145244&systemType=%27Receiver%27&transactionTimer=5000 2021-06-06 10:37:08.165 INFO 5604 --- [ession@31859960] org.jsmpp.session.SMPPSession : PDUReaderWorker 停止 2021-06-06 10:37:08.166 INFO 5604 --- [ Thread-2] o.a.camel.impl.DefaultShutdownStrategy : 正常关闭 1 路线在 0 秒内完成 2021-06-06 10:37:08.202 INFO 5604 --- [ 线程 2] o.a.camel.spring.SpringCamelContext : Apache Camel 2.20.1 (CamelContext: camel-1) 正常运行时间 1.629 秒 2021-06-06 10:37:08.203 INFO 5604 --- [ Thread-2] o.a.camel.spring.SpringCamelContext:Apache Camel 2.20.1 (CamelContext: camel-1) 在 0.257 秒内关闭进程完成 退出代码为 0

编辑 我已经添加了这些选项:camel.springboot.main-run-controller = true 然后我在我的日志中看到了这个新行,但它以相同的方式完成。

enter image description here

解决方法

有一些选择:

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...