1

I am using Stringboot, springboot starter artemis and camel

here is my dependencies for them:

compile('org.springframework.boot:spring-boot-starter-artemis')

compile 'org.springframework:spring-jms'
compile 'org.apache.activemq:artemis-jms-client:1.5.6'
compile 'org.apache.activemq:artemis-jms-server:1.5.6'
// https://mvnrepository.com/artifact/org.apache.camel/camel-jms
compile group: 'org.apache.camel', name: 'camel-jms', version: '2.20.2'

Here is my code(I am not using jms template here due to some reason)

  Connection connection = connectionFactory.createConnection();

            try {
                connection.setClientID(clientId);
                connection.start();

                //Create a JMS session
                Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);

                Topic topic = ActiveMQJMSClient.createTopic(processedHeaders.get(jmsdestination));
******JmsMessageUUID will dynamic, i have added JmsMessageUUID value = ID:142536687 as a example*********
                String selector = "JmsMessageUUID = 'ID:142536687'";
                //Create the subscription and the subscriber.
                MessageConsumer subscriber = session.createConsumer(topic,selector);

                //Consume the message from the durable subscription
                TextMessage messageReceived = (TextMessage) subscriber.receive();
                System.out.println("Received message: " + messageReceived.getText());
                // Acknowledge message
                messageReceived.acknowledge();
            }  finally {
                if (connection != null) {
                    // Close our JMS resources!
                    connection.close();
                } }
        }

i am trying to select message with JmsMessageUUID, it is basically a random string which is set during send message, Jms selector is unable to find out message, but when i am not using selector than successfully consumed message also I have checked the jms properties in received message, and the JmsMessageUUID is available in the properties with same string value.

I am unable to figure out why selector is not working ? Please help me here ..

I have also found JMSMessageID filter worked with Queue but not with Topoc:(

Baba
  • 311
  • 1
  • 2
  • 12
  • Just to make sure: the message is sent **after** you start your Consumer, right? Because a **durable subscriber receives only messages that were sent after he subscribed**. – burki Mar 13 '18 at 15:32
  • Yes but as i have mentioned static selector is part for subscription and so subscription will only receive filter messages based on selector, Here i need to configure dynamic selector, I have subscribe topic before message sent, but as i mentioned problem is dynamic selector – Baba Mar 13 '18 at 16:21

0 Answers0