Can you tell more about broker and connection? 1) Are you connecting to ActiveMQ Classic or Artemis 2) Which version of ActiveMQ is used? 3) How does the connectionFactory is setup?
For ActivMQ classic I use the ActiveMQ Component ( https://camel.apache.org/components/latest/activemq-component.html). For artemis I use the SJMS like you, but you may need to the TimeToLive on the connection, like this: cf.setConnectionTTL(-1); Regards, Raymond Op ma 21 okt. 2019 om 09:36 schreef Mikael Andersson Wigander < mikael.grevs...@gmail.com>: > We have similar issues as per this jira issue: > > https://issues.apache.org/jira/browse/CAMEL-10912 > > Our route receives a file once a day and shall process this and send a > message to a queue. > > We get too many Session closed issues now. > > We are only using a ConnectionFactory > > @Bean > public void sjms2ComponentConfiguration() { > final Sjms2Component component = new Sjms2Component(); > component.setConnectionFactory(new > ActiveMQConnectionFactory(brokerURL)); > camelContext.addComponent("sjms2", component); > } > > No additional arguments on either broker url nor route > > > from("seda://jsonImporter") > > .routeId("DATA-IMPORTER-JSON") > > .routeDescription("Imports data from text files as json") > > .autoStartup("{{importer.startup}}") > > > .split().jsonpathWriteAsString(simple("${header.FileSplitter}").getText()) > //<.> > > .streaming() > > .parallelProcessing() > > .choice() > > .when(body().isNotNull()) > > .log(LoggingLevel.DEBUG, "${body}") > > .process(exchange -> { > > final Message in = exchange.getIn(); > > final JsonPathExpression jsonPathExpression = new > JsonPathExpression(); > > jsonPathExpression.setExpression(in.getHeader("IdPath", > String.class)); > > final String id = jsonPathExpression.evaluate(exchange, > String.class); > > in.setHeader("InternalReference", id); > > }) > > .bean(XSDMapping.class, "create") > > .marshal(jaxbDataFormat) > > .convertBodyTo(String.class) > > .to("{{jms.queue.outgoing}}") > > > > .to("log:FILE-IMPORTER-TEXT?level=INFO&groupInterval=5000&groupActiveOnly=true") > > .end(); > > //end::seda://jsonImporter[] > > } > > What we have seen is that a restart of ActiveMQ does NOT fix the issue > only a restart of application > > > 2019-10-21 08:35:09,064 [Camel (LRM-DataImporter) thread #13 - Split] > Error logged in Shuttle WARN - New exception occurred during processing by > the DeadLetterChannel[sjms2://queue:grateful_dead] due Unable to complete > sending the JMS message. Exchange[ID-NSAAP476-1571205854859-0-144]. Caused > by: [javax.jms.IllegalStateException - The Session is closed]. The new > exception is being handled as deadLetterHandleNewException=true.(213) > org.apache.camel.CamelExchangeException: Unable to complete sending the > JMS message. Exchange[ID-NSAAP476-1571205854859-0-144]. Caused by: > [javax.jms.IllegalStateException - The Session is closed] > at > org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:82) > at > org.apache.camel.component.sjms.SjmsProducer.process(SjmsProducer.java:259) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) > at > org.apache.camel.processor.FatalFallbackErrorHandler.process(FatalFallbackErrorHandler.java:82) > at > org.apache.camel.processor.RedeliveryErrorHandler.deliverToFailureProcessor(RedeliveryErrorHandler.java:1063) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:474) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) > at > org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:117) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > at > org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109) > at > org.apache.camel.processor.MulticastProcessor.doProcessParallel(MulticastProcessor.java:859) > at > org.apache.camel.processor.MulticastProcessor.access$200(MulticastProcessor.java:86) > at > org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:330) > at > org.apache.camel.processor.MulticastProcessor$1.call(MulticastProcessor.java:316) > at java.util.concurrent.FutureTask.run(Unknown Source) > at java.util.concurrent.Executors$RunnableAdapter.call(Unknown > Source) > at java.util.concurrent.FutureTask.run(Unknown Source) > at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown > Source) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown > Source) > at java.lang.Thread.run(Unknown Source) > Suppressed: org.apache.camel.CamelExchangeException: Unable to > complete sending the JMS message. > Exchange[ID-NSAAP476-1571205854859-0-144]. Caused by: > [javax.jms.IllegalStateException - The Session is closed] > at > org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:82) > at > org.apache.camel.component.sjms.SjmsProducer.process(SjmsProducer.java:259) > at > org.apache.camel.processor.SendProcessor.process(SendProcessor.java:148) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > ... 19 common frames omitted > Caused by: javax.jms.IllegalStateException: The Session is closed > at > org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:771) > at > org.apache.activemq.ActiveMQSession.configureMessage(ActiveMQSession.java:759) > at > org.apache.activemq.ActiveMQSession.createTextMessage(ActiveMQSession.java:422) > at > org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessageForType(JmsBinding.java:530) > at > org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessage(JmsBinding.java:470) > at > org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.java:285) > at > org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.java:226) > at > org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:70) > ... 22 common frames omitted > Caused by: javax.jms.IllegalStateException: The Session is closed > at > org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:771) > at > org.apache.activemq.ActiveMQSession.configureMessage(ActiveMQSession.java:759) > at > org.apache.activemq.ActiveMQSession.createTextMessage(ActiveMQSession.java:422) > at > org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessageForType(JmsBinding.java:530) > at > org.apache.camel.component.sjms.jms.JmsBinding.createJmsMessage(JmsBinding.java:470) > at > org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.java:285) > at > org.apache.camel.component.sjms.jms.JmsBinding.makeJmsMessage(JmsBinding.java:226) > at > org.apache.camel.component.sjms.producer.InOnlyProducer.sendMessage(InOnlyProducer.java:70) > ... 24 common frames omitted > 2019-10-21 08:38:01,832 [http-nio-8080-exec-168] > c.c.t.d.DataimporterApplication INFO - So long and thanks for all the > fish!(88) > 2019-10-21 08:39:36,278 [http-nio-8080-exec-204] > c.c.t.d.DataimporterApplication INFO - Starting DataimporterApplication > v1.0.0 on NSAAP476 with PID 3196 (started by NSAAP476$ in > E:\apache-tomcat-8.5.23-SNN)(50) > 2019-10-21 08:39:36,278 [http-nio-8080-exec-204] > c.c.t.d.DataimporterApplication DEBUG - Running with Spring Boot > v2.1.8.RELEASE, Spring v5.1.9.RELEASE(53) > 2019-10-21 08:39:36,278 [http-nio-8080-exec-204] > c.c.t.d.DataimporterApplication INFO - The following profiles are active: > PROD(652) > 2019-10-21 08:39:55,619 [http-nio-8080-exec-204] c.c.t.d.r.FileImporter > INFO - File Importer(126) > 2019-10-21 08:39:55,619 [http-nio-8080-exec-204] c.c.t.d.r.FileImporter > INFO - dataImporterProperties = > DataImporterProperties(sources=[Source(type=json, split=$, name=DW SNN, > id=$.id, useHeader=false)])(128) > 2019-10-21 08:39:56,276 [http-nio-8080-exec-204] c.c.t.d.r.PreampAlliansen > INFO - PreampAlliansen(83) > 2019-10-21 08:39:58,074 [http-nio-8080-exec-204] > c.c.t.d.DataimporterApplication INFO - Started DataimporterApplication in > 24.47 seconds (JVM running for 434127.25)(59) > 2019-10-21 08:39:58,715 [registrationTask1] > d.c.b.a.c.r.ApplicationRegistrator INFO - Application registered itself as > 6292e7016e4c(98) > 2019-10-21 08:40:00,075 [Camel (LRM-DataImporter) thread #3 - > file://mifir/input/import] FILE-IMPORTER INFO - FileImporter > CamelBatchSize = 1(159) > 2019-10-21 08:40:00,075 [Camel (LRM-DataImporter) thread #3 - > file://mifir/input/import] FILE-IMPORTER INFO - FileImporter > CamelFileName = json\DW SNN\SNN_20191020_pretty.json(159) > 2019-10-21 08:40:00,075 [Camel (LRM-DataImporter) thread #3 - > file://mifir/input/import] c.c.t.d.r.FileImporter DEBUG - > {breadcrumbId=ID-NSAAP476-1571639984706-0-2, CamelFileAbsolute=false, > CamelFileAbsolutePath=E:\apache-tomcat-8.5.23-SNN\mifir\input\import\json\DW > SNN\SNN_20191020_pretty.json, CamelFileLastModified=1571634980337, > CamelFileLength=2752, CamelFileName=json\DW SNN\SNN_20191020_pretty.json, > CamelFileNameConsumed=json\DW SNN\SNN_20191020_pretty.json, > CamelFileNameOnly=SNN_20191020_pretty.json, > CamelFileParent=mifir\input\import\json\DW SNN, > CamelFilePath=mifir\input\import\json\DW SNN\SNN_20191020_pretty.json, > CamelFileRelativePath=json\DW SNN\SNN_20191020_pretty.json, FileSplitter=$, > FileType=json, IdPath=$.id, OriginatingSystem=DW SNN, Source=SNN, > UseHeader=false}(316) > 2019-10-21 08:40:03,921 [Camel (LRM-DataImporter) thread #2 - > ThroughputLogger] FILE-IMPORTER-TEXT INFO - Received: 5 new messages, with > total 5 so far. Last group took: 3455 millis which is: 1,447 messages per > second. average: 1,447(159) > >