问题
I have 2 applications (client and server) using a request-reply pattern.
The client sends a request to the server the message ID is set to something like this: ID=Hostname-52991-1357677886768-3:1:2:1:1
.
Now the client has to listen to a message with a correlation ID set to the same value. Since the value contains special characters (:) I have to encode the value (using UTF-8).
Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have to encode special characters such as = as %3D
So the selector should look like JMSCorrelationID='ID=Hostname-52991-1357677886768-3:1:2:1:1'
and the encoded selector should look like JMSCorrelationID='ID%3AHostname-52991-1357677886768-3%3A1%3A2%3A1%3A1'
I guess.
I have struggled for a couple of hours now and searched and read everything I could find but I cannot get this thing to work and it's driving me nuts.
Using only ASCII characters like abcd
works.
回答1:
Your JMS selector selector is being HTML encoded which will not work with the underlying system(as it will never match a message). The expression JMSCorrelationID='ID=Hostname-52991-1357677886768-3:1:2:1:1' should work as is.
来源:https://stackoverflow.com/questions/14224462/jms-encoded-message-selector-not-matching-when-using-special-characters