camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dusausoy <>
Subject Processor explanation
Date Tue, 20 Jul 2010 08:23:57 GMT

I'm a little confused by the use of a processor when consuming message (in
POJO mode) from a CXF endpoint.
Basically, what I want to do is consuming messages from the latter : just
knowing what the operation is and do some processing depending on it,
returning the result to the caller (the producer) and then let the message
continue its journey through the routes I've configured.

public class CareerRouteBuilder extends SpringRouteBuilder {

    // ...
    public void configure() throws Exception {
        from("cxf://bean:myService").process(new Processor() {
            public void process(Exchange exchange) throws Exception {
                String operation =
exchange.getIn().getHeader(CxfConstants.OPERATION_NAME, String.class);
                 * Maybe I could use reflection on a bean implementing the
                 * automatically generated by CXF's codegen-maven-plugin
instead of using "if" statements.
                if (operation.equals("SomeOperation")) {
                    MyResponse res =
                } else if (operation.equals("AnotherOperation")) {
                    // ...
                } else {
                    // ...

It works fine, but is it the best way to do what I want ?
Of course I could also use CXF directly and then route manually the result
to the desired endpoint.
But it would definitely be nicer if I could directly use a bean to process
the desired operation.
I've read the CXF Component documentation but haven't found anything like
Am I missing something ?

Bruno Dusausoy
YP5 Software
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

View raw message