Hello,
I've been struggling for a week or two to find an example that fits my
situation.
I've successfully written a number of camel routes and deployed them in
servicemix 4.3.
I wrote a camel route that receives an email with XML paragraphs in it.
Another camel route splits the XML into individual paragraphs and sends each
one to a seda queue for use in another camel route.
I want write that other camel route to receive that message and create a
record in a mysql table. Eventually I want to write other consumers of that
paragraph, but I'm starting with this task.
I think I want servicemix to manage the connections to the database and not
just use JDBC inside my bean which would sort of defeat the point of using
an ESB.
Since there are multiple data items, I can't substitute using "#" in a sql
component. I read that a bean that emits the insert command would be easy.
Not for me. I've seen an example where an XPath annotation preceding the
arguments in the bean would decode each data item, and in the java code I
construct the insert statement in a single line of code. That looks like the
ticket.
I think I need to:
1. Use maven to create a java project
2. Write my pojo with the XPath decoding the body and then construct the sql
insert command
3. Use maven install to create my jar file
4. Copy the jar file to servicemix/deploy
5. Write a camel DSL route:
<from uri="seda://myqueue" />
<bean sqlinsert ... confuses me />
<to sql ... confuses me more />
6. Copy it to servicemix/deploy
7. use it
I've read about idempotent, jdbc, jpa, ibatis and probably more. I just
can't get my head around linking the method in my pojo to a route in my
Camel DSL.
Please suggest a way forward. The only way through learning servicemix and
camel may be to keep trying until I succeed, but after a week or two of
trying, I need a little help.
Kind regards,
RC
PS, I was hoping that using XML would make it easy to inspect and manipulate
the data elements from inside a camel route via simple EL, but that is
beyond me as well.
--
View this message in context:
http://servicemix.396122.n5.nabble.com/servicemix-camel-and-a-bean-tp4720609p4720609.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.