revert activemq to v5.17.x

This commit is contained in:
Peter Hormanns 2023-08-14 20:41:24 +02:00
parent 9d09d43f3d
commit 87efe77c78
2 changed files with 9 additions and 10 deletions

View File

@ -43,15 +43,8 @@
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.18.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
<artifactId>activemq-client</artifactId>
<version>5.17.5</version>
</dependency>
</dependencies>
<build>

View File

@ -164,9 +164,11 @@ public class QueueServer implements MessageListener, ExceptionListener {
protected void sendStatus(TaskTransfer queueMessage) {
final ActiveMQConnectionFactory mqConnectionFactory = new ActiveMQConnectionFactory(jmsUrl);
mqConnectionFactory.setTrustAllPackages(true);
QueueConnection queueConnection = null;
MessageProducer producer = null;
QueueSession session = null;
try (QueueConnection queueConnection = mqConnectionFactory.createQueueConnection(jmsUsername, jmsPassword)) {
try {
queueConnection = mqConnectionFactory.createQueueConnection(jmsUsername, jmsPassword);
queueConnection.setExceptionListener(this);
session = queueConnection.createQueueSession(false, QueueSession.CLIENT_ACKNOWLEDGE);
final Queue queue = session.createQueue(jmsStatusQueue);
@ -177,6 +179,10 @@ public class QueueServer implements MessageListener, ExceptionListener {
producer.send(statusMessage);
} catch (Exception statusException) {
logger.log(Level.SEVERE, statusException.getMessage(), statusException);
} finally {
if (producer != null) try { producer.close(); } catch (Exception e) { }
if (session != null) try { session.close(); } catch (Exception e) { }
if (queueConnection != null) try { queueConnection.close(); } catch (Exception e) { }
}
}