2 Replies Latest reply on Sep 4, 2007 6:17 AM by toby saville

    CBR Content Location

    toby saville Novice

      I am placing a MyRequest object in my message using

      ActionUtils.setTaskObject(message, myRequest);
      


      I then have my service configured with the following action
      org.jboss.soa.esb.actions.converters.ObjectToXStream
      


      So the object is converted to XML prior to using the following action for routing based on the value of the XML output by the previous Action
      org.jboss.soa.esb.actions.ContentBasedRouter
      


      This approach is simply so i dont have to do the trivial conversion to XML using XStream, myself.

      The problem however, is that in the ContentBasedRouter Action, the body's byte array is inspected, instead of the named object used by ObjectToXStream (ie ActionUtils.getTaskObject)

      Can i suggest that a method such as the following be used in the class called org.jboss.internal.soa.esb.services.routing.cbr.DslHelper so that both places are checked during CBR:
       private static byte[] getContents(Message message) {
       byte[] contents = message.getBody().getByteArray();
      
       if (contents == null
       || (contents !=null && contents.length == 0)) {
       Object obj = ActionUtils.getTaskObject(message);
      
       if (obj instanceof String) {
       contents = ((String)obj).getBytes();
       }
       }
      
       return contents;
       }
      


      - tobes