[ https://issues.apache.org/jira/browse/ARTEMIS-4044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephen Baker closed ARTEMIS-4044. ---------------------------------- Resolution: Invalid > AMQ219010: Connection is destroyed with embedded artemis in tests > ----------------------------------------------------------------- > > Key: ARTEMIS-4044 > URL: https://issues.apache.org/jira/browse/ARTEMIS-4044 > Project: ActiveMQ Artemis > Issue Type: Bug > Environment: MacOS 12.6 > Corretto JDK 11 > Spring Boot 2.7.4 > artemis.version set to 2.26.0 > Reporter: Stephen Baker > Priority: Minor > Attachments: failure.log, success.log, success_2_19_1.log > > > I have a unit test for verifying a listener routine I wrote in the event of > an Artemis failure. > With artemis-server 2.25.0 and 2.26.0 it is periodically failing to obtain a > connection AFTER the server has finished starting. > {code:java} > @Test > void receiveBatchesTest_resilientToJmsFailure() throws Exception { > var receiveCount = new AtomicInteger(0); > BatchingJmsListenerDefinition<String> listener = > BatchingJmsListenerDefinition.builder(String.class) > .concurrency(1) > .maxBatchSize(10) > .destination("TestQueue") > .jmsTemplate(jmsTemplate) > .target(s -> receiveCount.addAndGet(s.size())) > .receiveTimeout(Duration.ofSeconds(1)) > .errorPauseTime(Duration.ofMillis(1)) > .build(); > embeddedActiveMQ.stop(); > registry.registerListener(listener, true); > await().atLeast(Duration.ofMillis(1000)); > embeddedActiveMQ.start(); > jmsTemplate.convertAndSend("TestQueue", "message1"); > jmsTemplate.convertAndSend("TestQueue", "message2"); > await().atMost(5, TimeUnit.SECONDS).until(() -> receiveCount.get() == 2); > }{code} > * [^failure.log] > * [^success.log] > * [^success_2_19_1.log] > When {{registerListener}} is called we expect a connection failure and on > 2.19.1 we get one there "AMQ219007: Cannot connect to server(s). Tried with > all available servers." but it should catch and try again until the server > comes up, and then when we write to the queue after the server is up we > definitely expect the connection to work, but as can be seen in the > [^failure.log] we are getting: > {noformat} > ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219010: > Connection is destroyed{noformat} > Line 117 is the first {{jmsTemplate.convertAndSend}}. -- This message was sent by Atlassian Jira (v8.20.10#820010)