camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Poyan G <poyan.ger...@gmail.com>
Subject Re: camel sql component
Date Wed, 21 May 2014 20:39:34 GMT
created jira https://issues.apache.org/jira/browse/CAMEL-7455
My route finish:s after the sql insert, so I guss nothing happens after
that.



2014-05-21 9:14 GMT+02:00 Pontus Ullgren <ullgren@gmail.com>:

> Hi,
>
> I'm just fine.
>
> Provided that you do this only within one route and do not
> pass the message over any external protocol (such as JMS)
> with the headers there should not be much overhead since
> the header value is a reference to the same String object.
>
> So make sure to set the header just before the <to uri="sql..." />
> and then remove the headers before passing the exchange to another
> transport.
>
> But as Claus suggest please open a Jira with a improvement suggestion for
> adding support for reading the body or even support simple expressions
> in the statement.
>
> // Pontus
>
>
> On Tue, May 20, 2014 at 11:34 PM, Poyan G <poyan.gerami@gmail.com> wrote:
> > Hello Pontus,
> > How are you ? :)
> > Actually that was the way I solved it, but I field that it should be an
> > better solution on it,
> > I don't now how much overhead it is to set the body as a header ?
> > I think it should be an better way to set the body in the sql statement.
> > Thanks
> >
> >
> >
> >
> > 2014-05-20 23:20 GMT+02:00 Pontus Ullgren <ullgren@gmail.com>:
> >
> >> Hello Poyan,
> >>
> >> You could try something like this to assign a header the value of the
> >> body and then use the header name.
> >> ------
> >> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
> >>     <route>
> >>       <from uri="direct:start"/>
> >>       <setHeader headerName="theId">
> >>         <simple>id</simple>
> >>       </setHeader>
> >>       <setHeader headerName="theMessage">
> >>         <simple>body</simple>
> >>       </setHeader>
> >>       <to uri="sql:insert into messages (id, message) VALUES (:#theId,
> >> :#theMessage)?dataSource=#myDataSource"/>
> >>       <to uri="mock:result" />
> >>     </route>
> >>   </camelContext>
> >> ------
> >>
> >> Hope this helps
> >> // Pontus
> >>
> >> On Tue, May 20, 2014 at 10:11 PM, Poyan G <poyan.gerami@gmail.com>
> wrote:
> >> > Hello,
> >> >
> >> > I have an route there I want to insert complete message in an row in
> the
> >> > database, the problem is that the insert statement want # header name
> or
> >> > body name, and to have body name my body need to be hashmap, my body
> is
> >> > just an String and I want to insert the complete string in to
> database.
> >> > What is the best way to to this ? I do not use Java for my route it's
> >> plain
> >> > spring camel xml configuration.
> >> >
> >> > Thanks
> >> >
> >> > --
> >> > Poyan Gerami
> >> > poyan.gerami@gmail.com
> >>
> >
> >
> >
> > --
> > Poyan Gerami
> > poyan.gerami@gmail.com
>



-- 
Poyan Gerami
poyan.gerami@gmail.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message