Bypassing message selector of an endpoint

Posted by habin123 on 16-Jan-2012 01:09

Hi
I have a requirement to bypass the message selector of an Endpoint. Is it possible any way?
Requirement:
A message selector is already defined for an entry endpoint of a process as: COUNTRY IN (‘DE’, ‘US’).
Is there a way by which a message can be processed by the ESB process configured with this endpoint without having this criteria (DE, US) in the message (possibly skipping the message selector criteria)?
Please suggest.
Many Thanks,
Habin

All Replies

Posted by pmeadows on 16-Jan-2012 06:01

Can you provide further background on the use case?  Is this an ongoing requirement or something you just need temporarily for a message that was sent incorrectly (e.g. with missing headers) and hence isn't being processed?

I think you'd have to modify the selector in the Endpoint's definition then restart the ESB Container hosting the process.

Another option might be to have a separate service or JMS client pick up the message you want to get processed (possibly using an alternative selector to extract a specific message), modify the message's headers to match the endpoint's selector, and resend the message to the endpoint's destination so it can get picked up via the existing endpoint definition.

Posted by habin123 on 23-Jan-2012 01:35

Thanks Paul for the reply and sorry for the late response from my side. For some reasons I was not able to check mailsL.
I’m trying to develop a tool for some of our internal requirements. This tool sends a special xml message to the entry endpoint of a process which will be processed by my .aj class and will not be send further down the itinerary of the process (already deployed in domain and can’t be changed). This .aj class performs all my required tasks. The xml message that is sent from the tool contains info about that tasks needs to be performed by .aj class.
Now as our domain has multiple processes deployed with a wide range of message selector at their entry endpoint. The tool works fine for all the processes which don’t have message selector at entry endpoint but creates problem with process having message selector at entry endpoint. This is because the xml message sent from the tool will not be picked by the process entry and the .aj class will not be called.
Is there a way to skip the message selector so that the message can reach the .aj class ?
I also thought to fetch message selector of the process through API and set it in the outgoing message of the tool but I’m getting the message selector as null. Below is the code that I have used. Please let me now what I’m doing wrong here. This will be a complex logic and I would prefer the first way (skip message selector).
ESBAPI api = factory.createAPI("Domain1", "tcp://localhost:2508", "Administrator", "Administrator");
IProcessConfigAPI ss = api.getProcessConfigAPI();
IProcessConfig t = ss.getProcess("MyProcess");
IEndpointConfig eConfig = t.getEntryEndpointConfig();
IJMSEndpointConfig jms = (IJMSEndpointConfig)eConfig.getAdapter(com.sonicsw.esb.mgmtapi.config.IEndpointConfig.JMS_TOPIC);
System.out.println("MessageSelector ::"+jms.getMessageSelector());
I hope you are able to understand the requirement.
Thanks a lot,
Habin

Posted by pmeadows on 23-Jan-2012 05:43

I believe there's a bug with IJMSEndpointConfig.getMessageSelector() which is causing it to return null.  Thank you for alerting us to it.  I've logged defect SNC00083229.  Please follow this up with Tech Support if needed.

A couple of other options that spring to mind:
  1. Modify your existing selectors so they include an additional clause which allows them to pick up messages from the new tool.  For example, have the tool set a message property on the messages it generates, then replace selectors such as "" with " OR ".  Admittedly this seems a little intrusive.
  2. Deploy a new service to your containers, listening on its own endpoint, which will receive instructions from the tool and query/instruct the relevant services in the local container.  Depending on exactly what you're trying to achieve this might be a cleaner approach - decoupling the logic and message flow associated with this tool from the main business logic and message flow.

Posted by habin123 on 23-Jan-2012 08:11

Thanks Paul.
Making changes to existing artifacts cannot be an option in my scenario. There are some processes which don’t allow me to do this.
I’m planning something like to intercept the method using AspectJ which is called by sonic framework to validate message selector of an in coming message with the endpoint and return always true when the message is from tool.
Any help in this direction will be much helpful.
Thanks,
Habin

This thread is closed