ContentBasedRouter does not work!
viniciuscarvalho Dec 17, 2007 12:56 PMJBoss ESB version: 4.2.1.GA
Hello there! I was trying to get the CBR to work, and after many failures I decided to look at the code... :(
Well, It's no surprise my rules do not find any destination. It depends on a property named object-path. Here's the stack call for the CBR :
public Message process(Message message) throws ActionProcessingException { try { List<Service> outgoingDestinations = executeRules(message);
Ok, so it tries to get the outgoingDestinations at this point. No problem so far...
protected List<Service> executeRules(Message message) throws MessageRouterException { List<Service> outgoingDestinations = new ArrayList<Service>(); try { List<Object> objectList = _mapper.createObjectList(message, _messagePathList);
Now the above code is the source of the problems, as the property _messagePathList, is initialized with an empty arrayList (dunno why does CBR needs that, isnt that something for the BusinessRuleService???)
So the next piece of code shows that with an empty _messageList, I get an empty destinations, so, nothing can be found.
public List<Object> createObjectList (Message message,List<String> messageObjectPathList) throws ObjectMappingException { List<Object> objectList = new ArrayList<Object>(); if (messageObjectPathList!=null) { for (String messageObjectPath: messageObjectPathList) { Object value = getObjectFromMessage(message, messageObjectPath); if (value==null) { logger.warn("The value of " + messageObjectPath + " is null"); } else { if (value instanceof Collection) { Collection valuesList = (Collection) value; for (Object object : valuesList) { objectList.add(object); } } else if (value instanceof Map) { Map valuesMap = (Map) value; for (Object object : valuesMap.entrySet()) { objectList.add(object); } } else { objectList.add(value); } } } } return objectList; }
I was kinda confused where to post (here or developer forum). Just would like to know if I need to add the objec-path, and if so, the docs should be modified. CBR is a crucial piece of software in our project :)
Regards