You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vivekrao001 <vi...@gmail.com> on 2015/07/14 22:49:53 UTC
Camel Insert after ready Fixed length message from queue
Hi,
I'm successfully reading queue and parsing it into bean using bindy. But
next I need to insert in to db. What ever the expression I use, it giving
some error. Could some body help in forming the expression for the value
parameter.
-------------
BodyType com.myapp.vivek.component.Order
Body Order [id=11, item=ww]
----------
@Component
public class ReadMq extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
from("jms:queue:TestQueueOne")
.routeId("QueueListener")
.log("Queue Message :${body}")
.unmarshal()
.bindy(BindyType.Fixed, Order.class)
.log("Queue Message : ${body} :: order number ${body.id}")
.to("sql:insert into orders (id, item, processed) values (*#*, *#*,
false)")
.end();
}
}
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Insert-after-ready-Fixed-length-message-from-queue-tp5769316.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Insert after ready Fixed length message from queue
Posted by vivekrao001 <vi...@gmail.com>.
Hi,
Thank You, Its working now. I tried that option, may be I made a typo.
Thanks,
Vivek.
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Insert-to-DB-after-reading-Fixed-length-message-from-queue-tp5769316p5769363.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Insert after ready Fixed length message from queue
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You need to use named parameters in the sql, where you can use body to
refer to the body fields
http://camel.apache.org/sql-component
.to("sql:insert into orders (id, item, processed) values
(:#${body.id}, :#${body.item}, false)")
On Tue, Jul 14, 2015 at 10:49 PM, vivekrao001 <vi...@gmail.com> wrote:
> Hi,
>
> I'm successfully reading queue and parsing it into bean using bindy. But
> next I need to insert in to db. What ever the expression I use, it giving
> some error. Could some body help in forming the expression for the value
> parameter.
> -------------
> BodyType com.myapp.vivek.component.Order
> Body Order [id=11, item=ww]
> ----------
>
> @Component
> public class ReadMq extends SpringRouteBuilder {
>
> @Override
> public void configure() throws Exception {
> from("jms:queue:TestQueueOne")
> .routeId("QueueListener")
> .log("Queue Message :${body}")
> .unmarshal()
> .bindy(BindyType.Fixed, Order.class)
> .log("Queue Message : ${body} :: order number ${body.id}")
> .to("sql:insert into orders (id, item, processed) values (*#*, *#*,
> false)")
> .end();
> }
>
> }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Insert-after-ready-Fixed-length-message-from-queue-tp5769316.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2