Hi,
The JBoss ESB has various routing possibilities, but no dynamicaly configurated HTTPRouter
(as far as I know). I need contentbased message routing without having to declare each and
every http-endpoint in the jboss-esb.xml.
There are two options I see here without any ESB changes:
- Rewrite HttpRouter class and others to accept Properties instead of a ConfigTree.
- Rewrite ConfigTree class making it possible to programmaticaly add nodes
- Instantiate the HttpRouter with a hard coded xmlstring (See code example)
| public Message sendAnswer(Message message) throws ActionProcessingException{
| String responseUrl = (String)message.getBody().get("ResponseUrl");
| String responseOperation =
(String)message.getBody().get("ResponseOperation");
| String responseSoapAction =
(String)message.getBody().get("ResponseSoapAction");
| String xml =
| "<action class=\"nl.gouwit.esb.actions.HttpDynamicRouter\"
name=\"SendAnswerAction\" endpointUrl=\"" + responseUrl +
"\""
| + " method=\"POST\"
responseType=\"STRING\"\">"
| + "<header name=\"SOAPAction\"
value=\""+responseSoapAction+"\"/>"
| + "<header name=\"operation\"
value=\""+responseOperation +"\"/>"
| + "</action>";
| try {
| ConfigTree config = ConfigTree.fromXml(xml);
| HttpRouter router = new HttpRouter(config );
| router.process(message);
| }
| catch (ConfigurationException e) {
| throw new ActionProcessingException(e);
| }
| catch (SAXException e) {
| throw new ActionProcessingException(e);
| }
| return message;
| }
|
This code works, but I prefer have a solution where I do not need to create a config by
converting XML. I also don't prefer to write my own httprouter because I want to use
the ESB functionality as much as possible. Also I don't want to miss out on any newly
added functionality to the ESB.
Regards,
Hans
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262428#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...