<int-jms:message-driven-channel-adapter>
Using message driven adapter , i want to filter message from AMQ broker using selector .
message has to filtered against dynamic bean variable value which is validated using selector bean ref option
<int-jms:message-driven-channel-adapter>
Using message driven adapter , i want to filter message from AMQ broker using selector .
message has to filtered against dynamic bean variable value which is validated using selector bean ref option
In reply to your comments..
Thanks for your reply , I want to filter message using selector attribute in Message driven channel adaptor . i was able to call bean method inside selector attribute @bean.method() , but not able to pass header parameter to that method @bean.method(header.param) . I am expecting selector should validate dynamically passing the header parameter to bean method and return boolean result so that message can be filtered.
<int-jms:message-driven-channel-adapter connection-factory="connectionFactoryName"
destination="destinationName" channel="channelName"
selector="#{@bean.method(header.param)}" auto-startup="false"/>
the above selector attribute has bean method configured to receive header param dynamically whenever pick message from AMQ . but it is syntactically wrong not able to pass header param. can you help?
You don't seem to understand what a JMS message selector is...
selector="foo='bar'"
...tells the broker to only send messages with the foo property equal to bar.
It is configured on the consumer during startup.
What you have is not "dynamic". #{...} expressions are evaluated once during context initialization.
What you are trying to do makes no sense; there is no "message" from which to evaluate a header yet. You can't tell the broker which message(s) to send, based on the contents of a message. The filtering is done on the broker before sending the message(s).
If you don't mind "losing" the messages you are not interested in (or are consuming from a topic) and you want to filter the messages you want to process, then add a
<filter ... expression="#{@bean.method(header.param)}" />
after the adapter. You could use the discard channel to republish the ignored message(s) to another queue (or do something else with them).