You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by londonukm <gr...@outlook.com> on 2012/08/08 17:03:26 UTC

Camel JDBC 1.6.1

Hi,

I am using the camel jdbc endpoint, however it is giving me something of a
problem. I have a process where i receive an xml payload by ftp, i take that
payload and put it into a custom header parameter in the message and pass it
onto the jdbc endpoint to do a database insert. however, after doing the
insert the jdbc component seems to be wiping out all the headers that were
previously set. Is there anyway to stop the jdbc endpoint from deleting the
custom headers that have been added to the message. My route is below just
incase it helps to show what i am talking about.

    from(ftpIncomingURL) -- GET FILE FROM FTP
    .convertBodyTo(String.class)
    .choice()
    .when(header(FileComponent.HEADER_FILE_NAME).contains("_rpt.xml")) --
PASS ON
    .to("activemq:queue:"+ftpPollerQueueName)
    .when(header(FileComponent.HEADER_FILE_NAME).contains("_isin_rej.xml"))
-- REJECT
    .process(jdbcRejectProcessor) -- SET CUSTOM HEADER
    .to("jdbc:unavistajdbc")   -- UPDATE DATABASE
    .process(fsaRejectProcessor) -- CUSTOM HEADER GONE AND BODY EMPTY
    .choice()
    .when(header("jdbc.updateCount").isEqualTo(1))
    .process(logEvent)
    .to("activemq:queue:" + mainQueueName + "." + JMS_QUEUE_INCOMING_SUFFIX)
    .otherwise()
    .process(logNoEvent)
    .end()
    .end();

Many Thanks

Graham 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-1-6-1-tp5716995.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel JDBC 1.6.1

Posted by londonukm <gr...@outlook.com>.
Hi Christian,

Thank you for your help, i am unable to upgrade the client so i had to make
do with existing functionality. Unfortunately the very nice EIP you
mentioned enrich does not exist in my version and the aggregator pattern
doesnt quite do it either. I appreciate all these issues have been ironed
out in future versions. 

Just in case anyone is interested I manged to get around the problem in a
couple of different ways. In one use case I was able to make use of the
Multicast option where I did not care about the output of the JDBC
component.

In the second instance where I required the output of the JDBC component,
well its header jdbc.updateCount output I used a custom producer template,
exchange and message in order to fire of the message to the jdbc component,
get back the header value and then fire off another message based on content
to various other processors.

Many thanks for all the help

Graham



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-1-6-1-tp5716995p5717128.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel JDBC 1.6.1

Posted by Christian Mueller <ch...@gmail.com>.
This is fixed some time ago...
Is it possible for you to upgrade to 2.10.0 or so?
If not, you can use the Content Enricher Pattern [2] to work around this
issue.

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
[2] http://camel.apache.org/content-enricher.html

Best,
Christian



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-1-6-1-tp5716995p5717028.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel JDBC 1.6.1

Posted by Christian Müller <cm...@apache.org>.
You should subscribe to the list. Otherwise you post is not forwarded to the
mailing list where most of the developers listening...
Checkout http://camel.apache.org/discussion-forums.html

Best,
Christian 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-1-6-1-tp5716995p5717027.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel JDBC 1.6.1

Posted by "michal.warecki" <mi...@gmail.com>.
How /jdbcRejectProcessor/ processor looks like? 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-1-6-1-tp5716995p5717006.html
Sent from the Camel - Users mailing list archive at Nabble.com.