This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
How do we write a message selector whose values for the variables are known only at runtime? I have to write a mdb that selects specific messages using a selector.Though the names of the variables will be known , the values of the variables will be known only at runtime.(dependant on the database). Any suggestions? Thanks in advance
Hi, Then you have to go for QueueSession's createReceiver method public QueueReceiver createReceiver(Queue queue, java.lang.String messageSelector) throws JMSExceptionCreates a QueueReceiver object to receive messages from the specified queue using a message selector. Parameters: queue - the Queue to access messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer. Throws: JMSException - if the session fails to create a receiver due to some internal error. InvalidDestinationException - if an invalid queue is specified. InvalidSelectorException - if the message selector is invalid.
MessageSelector should have the check/condition for the given property