I am in a process implementing Message selector in my project so i did some test to figure out the behavior. It would be appreciate if some on provide me there views on this.
Let me explain my process and why i am going for this.
In my project i have multiple JMS AQ topics. And SOA Publishing and consuming message from the topic based on the standard XSD. Now when i publish message on to the topic in this case either target system consumes it or some of my SOA service listening to this topics and picks the message as soon it has an entry in the topic . I am consume the records using durable subscriber. Now why i am going with Message selector is based on the value in the xml getting from Topic i will decide to go with business logic or not for that interface. Suppose i will look for value in the xml, if it is there i will get into this logic else my switch terminates.
I understand from the oracle documentation using message selector i can't validate the value in the body. I can use only the properties values to filter the message.
Now coming to my experiment on this.
I create two composites one to publish and other to consume. Composite one publish it on Topic1 and Composite 2 consume the message from topic1. Now i set JMSPriority=3 in composite 1 and published on topic and in composite2 i given as *<property name="MessageSelector" value="JMSPriority='3'"/>*.
Now when i publish the message on topic1, Immediately my composite2 consumes the message and i verified it and came to know that it is picking messages with priority 3 only.
Now i changes the *<property name="MessageSelector" value="JMSPriority='4'"/>* and redeployed the process and publish the message on to the topic. This time it didn't pick the message as expected.
Now i redeployed the service again by changing the *<property name="MessageSelector" value="JMSPriority='3"/>* .
I am expecting that the earlier message which i publish with priority 3 should be picked now. But it didn't picked, but if i go with one more test and publish the message on to the topic 1 with priorty 3 then my consposite2 immediately getting the message.(*Please note that my durable subscriber remains the same in all the cases*)
From above test what i came to know is if i publish message on to the topic with priority 3 at that point of time if my message selector is not to set "JMSPriority='3" then i never can consume this message again even i redeploy with same priority or even i change the priority in EM console of composite2.
Can some one let me know what i came to know with above test is true or not. Or do i am missing some concept to under this behavior???
The behaviour looks acceptable for me... Topics are different than queues, if you publish a message to a queue and there is no suitable consumer at that moment the message will remain in the queue... But for a topic, looks acceptable for me to say that if you publish a message and there was no suitable subscriber at the moment the message can be discarded... The message was checked for all durable subscribers and there was no one to able to pick it up... So it can be safely discarded... If later you change your durable subscriber to a situation on what the previous message could be picked up, that may be too late... Nevertheless, that's a very particular case and may vary according to implementation...
May you can confirm the behaviour by checking the messages assigned to a durable subscriber... When you publish a message that doesn't match the selector, will the message even be listed at all?
In this my DurableSubscriber remains the same. And when i am publishing the message on to the topic, durablesubscriber is listening to the topic. So even my dequeue process is not there but still my subscriber is activity in topic_s table. I make sure that subscriber is there, in order to avoid losing the messages. Now my only problem is with the Message selector.
As i said earlier if i publish the message with priority =4 and subscriber is listening to the topic. Now i activated my De-Queue process to with the same subscriber name which already listening to the message on to the topic. Now in this case what i am accepts is my Dequeue process should pick message from the topic, but it's not picking it. If i publishing the message on to the topic and my De-queue topic is already in active state and then it 's receive the message.
Now i want to understand Why the earlier message is not picked by the process even my subscriber remains the same?