8 Replies Latest reply on Sep 24, 2011 8:27 AM by Kshitiz Garg

    Message Filtering using core APIs

    Kshitiz Garg Newbie

      Hi,

       

      I want to create a filter expression to create a consumer who is interested in a string property 'filter'.

       

      Creating queue:

      *************************

      hornetQManager.createQueue("topicName", "queueName");

       

      Creating consumer:

      *************************

      ClientConsumer messageConsumer = hornetQManager.getClientSession().createConsumer(hornetQManager.getSimpleString("queueName"),hornetQManager.getSimpleString("filter LIKE 'message%'"));

       

      Publishing message:

      *************************

      ClientMessage clientMessage = hornetQManager.createClientMessage(message);

      clientMessage.putStringProperty("filter", message.getKey());

      hornetQManager.sendMessageToAddress("topicName", clientMessage);

       

       

      Sent message->

       

      message1, message3

       

      But my MessageHandler is just getting message3.

       

      Am I doing something incorrect here? Is there any tutorial/example for it using core API?

       

      Regards,

      Kshitiz Garg