You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by user09772 <so...@gmail.com> on 2010/01/06 18:47:14 UTC

Re: ActiveMQ - Camel as client POST?

Thanks.

I've setup a route as you suggested.  I'm getting the following indicating i
need to specify dateFormat, but not sure where/how I do that.


Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> Marshal[org.apache.camel.model.dataformat.JsonDataForm
at@1271ba] <<< in route: Route[[From[direct://simple-http-send]] ->
[Marshal[org.apac... because of dataFormat must be specified
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:643)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:136)
        at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:601)
        at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1156)
        at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1073)
        at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1009)
        at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:158)
        at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:884)
        at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:197)
        at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
        ... 49 more
Caused by: java.lang.IllegalArgumentException: dataFormat must be specified
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> Marshal[org.apache.camel.model.dataformat.JsonDataForm
at@1271ba] <<< in route: Route[[From[direct://simple-http-send]] ->
[Marshal[org.apac... because of dataFormat must be specified
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:643)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:136)
        at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:601)
        at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1156)
        at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1073)
        at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1009)
        at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:158)
        at
org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:884)
        at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:197)
        at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
        ... 49 more
Caused by: java.lang.IllegalArgumentException: dataFormat must be specified



Stephen Gargan wrote:
> 
> Rest assured you're in the right place, Camel is exactly what you need! By
> POST i'm going to assume your service is a HTTP server of some kind?
> 
> By way of a simple example if the service is a simple http server
> expecting
> json, it might be as easy as defining a route as follows
> 
> public class SimpleJsonHttpRoute extends RouteBuilder
> {
>    public void configure() throws Exception
>    {
>        from("direct:simple-http-send").marshal().json().to("
> http://myserver:8080/service");
>    }
> }
> 
> You would use a producer template to send the hibernate pojo to the simple
> service endpoint
> 
> ProducerTemplate template = camelContext.createProducerTemplate();
> MyPojo entity = dao.loadPojo(id);
> template.sendBody("direct:simple-http-send", entity);
> 
> This would cause camel to convert the entity to a JSON string using
> XStream
> and use this as the content for a http request to the service at
> http://myserver:8080/service.
> 
> I've left out a few details here, but as Claus mentions (below), there are
> tons of examples and documentation to help you pick exactly what you need.
> If you have any questions then ping the list and someone will be happy to
> help.
> 
> rgds,
> 
> ste
> 
> from an earlier mail by Claus...
> Of course there is the camel documentation at
> http://camel.apache.org/
> 
> And the tutorials
> http://camel.apache.org/tutorials.html
> 
> And examples
> http://camel.apache.org/examples.html
> 
> And some blogs, articles on other sites at
> http://camel.apache.org/articles.html
> 
> And this thesis on Camel, although a bit old
> http://elib.uni-stuttgart.de/opus/volltexte/2008/3520/pdf/STUD_2127.pdf
> 
> And then there is a book in the works (I am one of the authors)
> http://www.manning.com/ibsen
> 
> And FUSE also have some additional documentation
> http://fusesource.com/products/enterprise-camel/#documentation
> 
> On Tue, Dec 22, 2009 at 4:16 PM, user09772 <so...@gmail.com> wrote:
>>
>> Hey,
>>
>> A oracle table is enqueuing ids to an activemq.  i Have a service as the
>> consumer of the queue, which dequeues ids from the queue and does a
> database
>> lookup based on that id, and eventually gets a POJO (from hibernate).  I
>> need a way to send this pojo to another service.  Can Camel do this for
> me?
>> I've not used camel before.  If not, what is the best way to send a post
> to
>> another service in this scenario.
>>
>> Thanks.
>> --
>> View this message in context:
> http://old.nabble.com/ActiveMQ---Camel-as-client-POST--tp26896366p26896366.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/ActiveMQ---Camel-as-client-POST--tp26896366p27026923.html
Sent from the Camel - Users mailing list archive at Nabble.com.