Java SpringBoot Camel ActiveMQ嵌入式代理意外停止并重新启动

Java SpringBoot Camel ActiveMQ嵌入式代理意外停止并重新启动,java,activemq,spring-camel,Java,Activemq,Spring Camel,我的SpringBoot Camel应用程序有问题 它可以很好地与非嵌入式代理配合使用。以下是它的配置: URL以字符串形式给出,该字符串指向独立的ActiveMQ serveur或嵌入式代理URL(vm://dpcgbroker?broker.persistent=false) 当我切换到嵌入式代理时,行为是不同的,ApacheActiveMQ会先启动,然后停止,然后重新启动。我不知道为什么,也没有例外 下面是日志的摘录 15967 INFO - 5063 - [Camel (camel-

我的SpringBoot Camel应用程序有问题

它可以很好地与非嵌入式代理配合使用。以下是它的配置: URL以字符串形式给出,该字符串指向独立的ActiveMQ serveur或嵌入式代理URL(vm://dpcgbroker?broker.persistent=false)

当我切换到嵌入式代理时,行为是不同的,ApacheActiveMQ会先启动,然后停止,然后重新启动。我不知道为什么,也没有例外

下面是日志的摘录

15967 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Using Persistence Adapter: MemoryPersistenceAdapter
15991 INFO  - 5063 -  [JMX connector] org.apache.activemq.broker.jmx.ManagementContext     - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
16106 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is starting
16111 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) started
16111 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - For help or more information please see: http://activemq.apache.org
16132 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.TransportConnector     - Connector vm://dpcgbroker started
16205 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.TransportConnector     - Connector vm://dpcgbroker stopped
16205 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is shutting down
16213 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) uptime 0.274 seconds
16213 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is shutdown
16618 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.processor.aggregate.AggregateProcessor     - Defaulting to MemoryAggregationRepository
16621 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.processor.aggregate.AggregateProcessor     - Using CompletionTimeout to trigger after 10 millis of inactivity.
16647 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.spring.SpringCamelContext     - Skipping starting of route jobStatusRoute as its configured with autoStartup=false
16656 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Using Persistence Adapter: MemoryPersistenceAdapter
16656 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:2) is starting
16657 INFO  - 5063 -  [JMX connector] org.apache.activemq.broker.jmx.ManagementContext     - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
16657 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:2) started
问题是,一些消息在代理的第一个实例中发送,当代理停止时丢失,然后第二个实例以空消息列表开始。 我不知道它为什么停了


PS:我不想使用持久性嵌入式代理,这是无用的解决方法,过了一段时间我才明白发生了什么。整个事情是嵌入式vm代理有一种特殊的行为,这在该状态的

一旦所有到代理的VM连接都关闭,嵌入式代理将自动关闭

我的应用程序正在启动,然后发送一条消息,然后消费者就启动了。当我发送消息时,连接被关闭,导致代理关闭

因此,解决方案只是首先启动消费者,然后允许生产者发布消息


PS:一个可能有用的解决方法是使用PooledConnectionFactory。我进行了测试,它也可以工作,因为我想池可以保持连接的活动状态。有了这些技巧,你可以按照你喜欢的顺序启动处理器和消费者

你能用嵌入式代理和getJmsConfiguration()发布整个代码吗?我添加了整个配置@hassenbennour没有理由让所描述的巴哈维奥。。。这是您唯一的代码还是您有其他东西?我有许多其他类(它是一个基于camel的应用程序)。我开始调试,我了解了一些,但仍然没有解决方案。我使用ProducerTemplate向JMS端点发送消息。在发送结束时,连接关闭,然后触发BrokerService关闭,这确实很奇怪。(无例外)
15967 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Using Persistence Adapter: MemoryPersistenceAdapter
15991 INFO  - 5063 -  [JMX connector] org.apache.activemq.broker.jmx.ManagementContext     - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
16106 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is starting
16111 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) started
16111 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - For help or more information please see: http://activemq.apache.org
16132 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.TransportConnector     - Connector vm://dpcgbroker started
16205 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.TransportConnector     - Connector vm://dpcgbroker stopped
16205 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is shutting down
16213 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) uptime 0.274 seconds
16213 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:1) is shutdown
16618 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.processor.aggregate.AggregateProcessor     - Defaulting to MemoryAggregationRepository
16621 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.processor.aggregate.AggregateProcessor     - Using CompletionTimeout to trigger after 10 millis of inactivity.
16647 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.camel.spring.SpringCamelContext     - Skipping starting of route jobStatusRoute as its configured with autoStartup=false
16656 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Using Persistence Adapter: MemoryPersistenceAdapter
16656 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:2) is starting
16657 INFO  - 5063 -  [JMX connector] org.apache.activemq.broker.jmx.ManagementContext     - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
16657 INFO  - 5063 -  [Camel (camel-1) thread #1 - file://conf/DR3/planets/] org.apache.activemq.broker.BrokerService     - Apache ActiveMQ 5.15.2 (dpcgbroker, ID:Greg.local-59246-1525440325893-0:2) started