On Sat, Oct 22, 2011 at 2:47 AM, pkleczka <[email protected]> wrote:
> Thanks Claus, I got it working. But have one more question. Page 304 of the
> Camel in Action book has a note about using the Direct component for
> multiple routes because it says the messages must "be processed in the same
> thread context". I am not sure I understand this or how I would alter the
> two routes below so that a direct component would tie them together.
>

Yeah using direct can tie routes together like

from X
  to direct:foo

from direct:foo
  to Y


About p304. Yeah its how the transaction manager requires this currently.
So for example if the 2nd route does some transactional work, like
writing a record in a database using JDBC.
And the 1st route pickup messages from a JMS broker. And you want
these two routes tied together, and
work in the same atomic transaction, then the JMS consumer and the
JDBC producer must run in the same thread.
And hence you should use the direct component to tie the routes together.


We are looking into support asynchronous transaction in the future (eg
in Camel 3.x).
So a TX manager can suspend an ongoing transaction, and handover this
to another thread, which can resume the transaction, and so forth.



>
>       &lt;!-- Validate that we pass Odyssey XSD or send to "rejected" queue
> --&gt;
>        <route id="EFileBatchRequestSubmit">
>            <from
> uri="properties:{{queue.efilebatch.request.validatedxsdbusrules}}" />
>               &lt;!-- ... some operations here ... --&gt;
>               <to uri="properties:{{queue.efilebatch.request.submitted}}" />
>        </route>
>
>        &lt;!-- Send to Odyssey ftp --&gt;
>        <route id="EFileBatchRequestFTP">
>            <from uri="properties:{{queue.efilebatch.request.submitted}}" />
>            <transacted ref="PROPAGATION_REQUIRED" />
>            <bean ref="formatFTPFileName" method="formatName" />
>            <to
> uri="properties:{{ftp.efilebatch.request.submitted}}?fileName=${header.JMSCorrelationID}.xml"
> />
>            <to uri="properties:{{log.efilebatch.request.submitted}}" />
>            <wireTap
> uri="properties:{{queue.efilebatch.request.submitted.tap}}" />
>        </route>
>
> *Would I do something like the following:*
>
>       &lt;!-- Validate that we pass Odyssey XSD or send to "rejected" queue
> --&gt;
>        <route id="EFileBatchRequestSubmit">
>            <from
> uri="properties:{{queue.efilebatch.request.validatedxsdbusrules}}" />
>               &lt;!-- ... some operations here ... --&gt;
>               <to uri="properties:{{queue.efilebatch.request.submitted}}" />
>               *<to uri="direct:tie" />*
>        </route>
>
>        &lt;!-- Send to Odyssey ftp --&gt;
>        <route id="EFileBatchRequestFTP">
>            *<to uri="direct:tie" /> &lt;!-- This replaces the: from
> uri="properties:{{queue.efilebatch.request.submitted}}" --&gt;*
>            <transacted ref="PROPAGATION_REQUIRED" />
>            <bean ref="formatFTPFileName" method="formatName" />
>            <to
> uri="properties:{{ftp.efilebatch.request.submitted}}?fileName=${header.JMSCorrelationID}.xml"
> />
>            <to uri="properties:{{log.efilebatch.request.submitted}}" />
>            <wireTap
> uri="properties:{{queue.efilebatch.request.submitted.tap}}" />
>        </route>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/FTP-producer-and-exception-or-transaction-tp4902912p4926428.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Reply via email to