Hiya James,

This is very cool. I like the predicate/processor API a lot.

Can you explain more what you mean by "I'm just not sure yet in the
CxfEndpoint how to bind inbound exchanges to the CXF bus and back again
nicely".

Maybe part of the problem is message representation. What do we think of
creating an XmlMessage which standardizes on using a Source object. Then
people can write processors which can work for most XML things. CxfMessage
could then extend XmlMessage.

- Dan



Sorry to hijack this thread; a bit of background first then I'll get
more on topic...

On the ActiveMQ and ServiceMix projects we've wanted a simple POJO
router for a while thats

* Apache Licensed
* small & simple with minimal dependencies (just commons-logging)
* allows routes to be defined easily in Java code or using Spring XML
* can work with any of the various messaging models and APIs from
HTTP, JMS, JBI, CXF, JAX-WS, MINA etc

A little experimental library soon turned into a fairly full featured
router very quickly. The documentation is still quite sparse, but let
me introduce you to Apache Camel...
http://activemq.apache.org/camel/

Here's a quick example to give you the idea...
http://activemq.apache.org/camel/routes.html

We've been documenting how the Enterprise Integration Patterns can be
implemented using Camel
http://activemq.apache.org/camel/enterprise-integration-patterns.html

Here's a quick overview of the architecture (we'll document this way
better soon)
http://activemq.apache.org/camel/architecture.html


One of the interesting things about Camel is it can work with any
underlying protocol using a small & simple API (similar to a
simplification & generalization of both CXF Bus API and JBI).  Not
only that, thanks to generics and covariant return types we can work
explicitly with specific protocols when required in a nice typesafe
manner to avoid leaky abstractions.

e.g.

// A JMS specfic processor
class Foo implements Processor<JmsExchange> {
  public void onMessage(JmsExchange exchange) {

    // lets do some direct JMS stuff..
    javax.jms.Message message = exchange.getInMessage();
  }
}

So we could easily route from JMS to CXF to JBI and into MINA say.

Enough of all that, lets show an example thats more releative to CXF...

RouteBuilder<Exchange> builder = new RouteBuilder<Exchange>() {
    public void configure() {

        // a declarative routing rule example
        from("cxf:myservice").choice()
                .when(version().isEqualTo("1.2")).to("cxf:myservice1.2")
                .when(xpath("/foo/[EMAIL PROTECTED] =
'edam')).to("cxf:myOtherService")
                .otherwise().to("jms:Error.Queue");
    }
};

In this particular case we're using a custom expression version()
which could be any old Expression<Exchange> implementation.


I think Camel could be useful for arbitrary declarative routing and
mediation rules in CXF. I've taken an early stab at supporting CXF Bus
API in Camel...

https://svn.apache.org/repos/asf/activemq/camel/trunk/camel-cxf/

I've got the main parts done (the exchange & message pieces), I'm just
not sure yet in the CxfEndpoint how to bind inbound exchanges to the
CXF bus and back again nicely. Also it'd be nice to resolve URI
endpoints in Camel nicely to auto-discover CXF endpoints and vice
versa. Then there's being able to put Camel inside CXF so that the
JAX-WS client will invoke Camel to do the routing etc


Thoughts and feedback most welcome - also any help getting Camel-CXF
working would be good too :)

--

James
-------
http://radio.weblogs.com/0112098/




--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to