Ok, just thinking at this point...and I don't yet understand Camel well
enough.  So, I need some insight.

What I want to do is use Camel to facilitate some back-end business logic in
my Grails app.  Here's the general idea.  From my Grails app I send a block
of text to a Route.  I want this route to be configured to take in a block
of raw text (seda:my.queue) and send my.queue as the body of an HTTP POST to
an external service - and consume the returned body, sending it back to a
Grails service.  I have the last part figured, but missing the Camel guts.

Here's where I'm starting:

class JobRoute {
    def configure = {
        println "Setting JobRoute Camel Router..."
        from("seda:my.queue") {
            Exchange exchange =
template.send("http://localhost:4567/jodmock";, 
                new Processor() {
                    process(exchange) {
                        exchange.getIn().setHeader(Exchange.HTTP_METHOD,
constant(org.apache.camel.component.http.HttpMethods.POST));
                    }
                }
            );
            Message out = exchange.getOut();
            int responseCode =
out.getHeader(HttpProducer.HTTP_RESPONSE_CODE, Integer.class);
        }
    }
}

The "new Processor() instantiation barfs during compile with:

[groovyc] /Users/kplummer/Development/ts/grails-app/routes/JobRoute.groovy:
9: You cannot create an instance from the abstract interface
'org.apache.camel.Processor'.
  [groovyc]  @ line 9, column 17.
  [groovyc]                    new Processor() {
  [groovyc] 

And, I haven't figured out to get the my.queue to the contents of the In.  

Help!

Thanks.
Kit
-- 
View this message in context: 
http://old.nabble.com/Grails-Camel---pass-queue-message-to-HTTP-POST--tp27318113p27318113.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to