Content based routing using XQ_getReplyToAddress()

Posted by Admin on 07-Jun-2010 09:07

Hello,

I would like to implement some content based routing within a Sonic ESB process, based on the REPLY-TO address filled in the message properties. To do so, I have created a routing rule file and use the XQ_getReplyToAddress() method to get the REPLY-TO address.

Some of the messages haven't a REPLY-TO address filled. Those messages will return an error message when processing the routing rules, using this method:

<rejectedDetails>com.sonicsw.xq.XQEndpointException: ReplyTo does not exist for this message.

Regarding the Sonic API Reference documentation, this method should return NULL when the REPLY-TO address is not set:

XQ_getReplyToAddress
public abstract XQAddress XQ_getReplyToAddress()Returns an single Address object correspoding to the REPLY_TO address of the service or process. This returns null if the REPLY_TO was not set.

Returns:
an XQAddress object corresponding to REPLY_TO, if available.

I have created some javascript within my routing rules file:

messageDestination=XQ_getReplyToAddress();

rule 1: messageDestination.getName()!=null

rule 2: messageDestination.getName()==null

This works fine when a REPLY-TO address will be available in the message, but the message will end on the RME queue when the REPLY-TO address has not been filled.

Does anyone know how to solve this issue?

Thanks in advance.

Michel

All Replies

Posted by tsteinbo on 08-Jun-2010 07:27

I have not tried, but what about a try-catch block catching the com.sonicsw.xq.XQEndpointException ?

Posted by Bill Wood on 12-Jun-2010 05:29

mheemskerk wrote:

....

Regarding the Sonic API Reference documentation, this method should return NULL when the REPLY-TO address is not set:

XQ_getReplyToAddress
public abstract XQAddress XQ_getReplyToAddress()Returns an single Address object correspoding to the REPLY_TO address of the service or process. This returns null if the REPLY_TO was not set.

Returns:
an XQAddress object corresponding to REPLY_TO, if available.

I have created some javascript within my routing rules file:

messageDestination=XQ_getReplyToAddress();

rule 1: messageDestination.getName()!=null

rule 2: messageDestination.getName()==null

I would think that the messageDestination is null (the result of XQ_getReplyToAddress), but when you then try to do a messageDestination.getName() you'll get your exception.   Try

rule1: messageDestination!=null

This thread is closed