Hello everybody,

I did search the forum for some similar questions/problems, but didn't find
matching entries.

I normally work with the Spring JmsTemplate, but did also try to reproduce
the problematic behaviour in a native ActiveMQ Java implementation.

// given factory is a ActiveMQConnectionFactory
        sendConnection = factory.createConnection();
        sendConnection.start();

        receiveConnection = factory.createConnection();
        receiveConnection.start();
 
        RecognitionSession recognitionSession = ... // my payload in the jms
message
        String selector = String.format("JMSCorrelationID='%s'",
recognitionSession.getClientSessionId());
 
        Session sendSession = sendConnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
        MessageProducer producer = sendSession.createProducer(queue);
        producer.setDeliveryMode(DeliveryMode.PERSISTENT);
        Message message =
sendSession.createObjectMessage(recognitionSession);
       
message.setJMSCorrelationID(recognitionSession.getClientSessionId());
        message.setJMSTimestamp(System.currentTimeMillis());
        producer.send(message);
 
        Session receiveSession = receiveConnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = receiveSession.createConsumer(queue,
selector);
        ObjectMessage receivedMessage = (ObjectMessage)
consumer.receive(25);
        RecognitionSession receivedRecognitionSession = null;

        if (receivedMessage != null) {
            receivedRecognitionSession = (RecognitionSession)
receivedMessage.getObject();
        }

        QueueBrowser browser = receiveSession.createBrowser(queue,
selector);
        // further checks if the recognitionSession is not in the delivered
Enumeration anymore

I did call this code in a kind of stress test 5000 times!

4964 times the message was received,
26 times the message receive(25) delivered null

any ideas, any hints welcome


--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Troubles-receiving-a-Message-with-a-Selector-tp3813397p3813397.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to