[ https://issues.apache.org/jira/browse/ARTEMIS-4044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17616628#comment-17616628 ]
Stephen Baker commented on ARTEMIS-4044: ---------------------------------------- Working on it, I have a much simpler reproduction now that takes all the chance out of it. 2.23.1 does have the new behaviour but I got unlucky with the earlier test. ``` {color:#bbb529}@Test {color}{color:#cc7832}void {color}{color:#ffc66d}proveMyPoint{color}() {color:#cc7832}throws {color}Exception { {color:#cc7832}var {color}connection = {color:#9876aa}jmsTemplate{color}.getConnectionFactory().createConnection(){color:#cc7832}; {color}{color:#cc7832} {color}{color:#9876aa}embeddedActiveMQ{color}.stop(){color:#cc7832}; {color}{color:#cc7832} {color}{color:#9876aa}embeddedActiveMQ{color}.start(){color:#cc7832}; {color}{color:#cc7832} {color}connection.createSession(){color:#cc7832}; {color}} ``` > 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)