Hi there,

we are still testing AciveMQ in preproduction here. Imagine following
situation:

we have two topics here that work as a request/response pair. The data
producer is permanently(not durable) subscribed to the request topic and
puts its payload into the response topic. The client uses a JMS Template
with a SessionCallback to sends its data requests to the request topic and
awaits responses in the response topic. Here the code that matters:

    @Override
    public Message doInJms(final Session session) throws JMSException {
        MessageConsumer consumer = null;
        MessageProducer producer = null;
        try {
            final String correlationId = UUID.randomUUID().toString();

            consumer = session.createConsumer(responseDestination,
"JMSCorrelationID = '" + correlationId + "'");

            final ObjectMessage message =
session.createObjectMessage(payload);
            message.setJMSCorrelationID(correlationId);
            message.setStringProperty("CLIENT_ID", clientUid);
            message.setStringProperty("GSE_ID", gseUid);
            producer = session.createProducer(requestDestination);
            producer.send(message);

            return consumer.receive(TIMEOUT);
        } finally {
            // Don't forget to close your resources
            JmsUtils.closeMessageConsumer(consumer);
            JmsUtils.closeMessageProducer(producer);
        }
    }

>From my understanding this creates the consumer, subscribes to the response
topic, creates the producer, sends the request, waits for the response or
the timeout(5000) and then finally closes producer and consumer on the
client side. Nevertheless I found by chance on the JMX console that our
running client has created subscriptions to the topic that sit there
constantly and aren't closed. Currently there are 37 connections to the
response topic, all coming from one connection. How could that happen?

cheers,
Kai

Reply via email to