I figured out the problem.  The way I was starting camel was automatically 
loading a Spring context in a dependent jar that configures the 
JmsTransactionManager.

Thanks for your help.

~Justin


-----Original Message-----
From: Justin Rosenberg [mailto:rosenbe...@crlcorp.com] 
Sent: Friday, December 16, 2011 11:23 AM
To: users@camel.apache.org
Subject: RE: Email and File .transacted()

I can see that the JmsTransactionManager is called even though I don't have one 
configured.  This is what lead me to believe that the Mail Poller requires one 
to be defined.  However the server I'm running this on does not have a broker 
configured.  I'll keep digging, but if this stack trace sheds any light, any 
help is appreciated.

org.springframework.transaction.CannotCreateTransactionException: Could not 
create JMS transaction; nested exception is javax.jms.JMSException: Could not 
create Transport. Reason: java.io.IOException: Broker named 'localhost' does 
not exist.
        at 
org.springframework.jms.connection.JmsTransactionManager.doBegin(JmsTransactionManager.java:210)
        at 
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
        at 
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
        at 
org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:164)
        at 
org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:121)
        at 
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:93)
        at 
org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:102)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
        at 
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
        at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
        at 
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)
        at 
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
        at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
        at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
        at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
        at 
org.apache.camel.component.mail.MailConsumer.processExchange(MailConsumer.java:263)
        at 
org.apache.camel.component.mail.MailConsumer.processBatch(MailConsumer.java:188)
        at 
org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:121)

Thank you,


~Justin


-----Original Message-----
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Friday, December 16, 2011 11:07 AM
To: users@camel.apache.org
Subject: Re: Email and File .transacted()

On Fri, Dec 16, 2011 at 5:59 PM, Justin Rosenberg
<rosenbe...@crlcorp.com> wrote:
> So my question is, why is it looking for a JMS queue when I use 
> .transacted().  I would assume I wouldn't need a JMS queue to do this 
> "pseudo-transactional" route.
>

You must have a JTA transaction manager defined in some XML file
somehere, that the .transacted() will lookup and use (convention over
configuration).
And the JTA transaction manager is wrongly configured. See the message
in the stacktrace that says something about a broker not found.



> Logs:
> 2011-12-16 09:34:59,298 INFO  [JtaTransactionManager] Using JTA
> UserTransaction:
> org.jboss.tm.usertx.client.ServerVMClientUserTransaction@1318e59
> 2011-12-16 09:34:59,298 INFO  [JtaTransactionManager] Using JTA
> TransactionManager:
> com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@787ee7
> ...
> 2011-12-16 09:35:14,509 WARN  [TransactionErrorHandler] Transaction rollback 
> (0x1fc212d) for ExchangeId: ID-C1002822-3963-1324049699423-0-2
> due exception: Could not create JMS transaction; nested exception is
> javax.jms.JMSException: Could not create Transport. Reason:
> java.io.IOException: Broker named 'localhost' does not exist.
>
>
> Application versions:
> Camel 2.7.0
> Spring 3.0.5.RELEASE
>
> ~Justin
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Friday, December 16, 2011 10:54 AM
> To: users@camel.apache.org
> Subject: Re: Email and File .transacted()
>
> On Fri, Dec 16, 2011 at 5:46 PM, Justin Rosenberg
> <rosenbe...@crlcorp.com> wrote:
>> Interesting.  It seems that if I have 
>> from(emailURI).transacted().process(processor) with a JMSTransactionManager 
>> defined.  It DOES work.  If the following processor fails, the file/email is 
>> left on the server...
>>
>
> That is because the Camel components uses UnitOfWork to defer the
> until the end when the exchange is done.
> Then they check the exchange status.
>
> If its okay, then they carry out their "commit" work such as for
> email, to mark the mail as DELETED | SEEN
> Likewise the file consumer will move the file / delete the file etc.
>
> However if the exchange is failed due an exception, then they will
> "compensate". Which mean usually they do not do any work.
> The email will leave the mail as is.
> The file will leave the file as is.
>
> So its "pseudo" transaction. But they do not participate in the
> transaction, and nor are they orchestrated by the transaction manager.
> Likewise they cannot participate in a XA 2-phase commit etc.
>
>
>
>> ~Justin
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
>> Sent: Friday, December 16, 2011 10:42 AM
>> To: users@camel.apache.org
>> Subject: Re: Email and File .transacted()
>>
>> Hi
>>
>> No transaction only works with resources which naturally supports
>> transactions. In reality this is often only limited to RDBMS and JMS
>> or the likes.
>> So email and file does not support transactions.
>>
>> If you send an email, its sent.
>> If you write a file, its written.
>>
>> However you can implement custom compensation logic to do work like a 
>> rollback.
>> For example to delete the written file, etc.
>>
>> If you got the Camel in Action book, then chapter 9 is all about
>> transaction and compensations.
>>
>>
>> On Fri, Dec 16, 2011 at 4:34 PM, Justin Rosenberg
>> <rosenbe...@crlcorp.com> wrote:
>>> Does the File and Email endpoint require a JMS transaction provider to
>>> do transactions or can it use JTA instead?
>>>
>>>
>>> ~Justin
>>>
>>>
>>> -----Original Message-----
>>> From: Justin Rosenberg [mailto:rosenbe...@crlcorp.com]
>>> Sent: Tuesday, December 06, 2011 7:47 PM
>>> To: users@camel.apache.org
>>> Subject: Mail component ContentTypeResolver SPI customization
>>>
>>> I'm having trouble understanding how to use a custom ContentTypeResolver
>>> for the mail component using Spring.
>>>
>>> Here is my Spring XML:
>>> <camel:camelContext
>>> id="CamelContext-${project.artifactId}_${project.version}">
>>>  <camel:contextScan />
>>> </camel:camelContext>
>>> <bean id="mail" class="org.apache.camel.component.mail.MailComponent">
>>>  <property name="contentTypeResolver">
>>>    <bean class="com.crlcorp.oasis.routing.util.CRLContentTypeResolver"
>>> />
>>>  </property>
>>> </bean>
>>>
>>> I'm retrieving the attachment in the processor as follows:
>>> DataHandler dh =
>>> exchange.getIn().getAttachments().values().iterator().next();
>>> String contentType = dh.getContentType();
>>>
>>> For testing I have the ContentTypeResolver always return the same value.
>>> However, the value that gets returned by dh.getContentType() is
>>> "APPLICATION/OCTET-STREAM; name="file.pdf"
>>> Am I missing a step to get the CamelContext to recognize the customized
>>> MailComponent?  I have tried using the same Spring XML setting the value
>>> on the MailEndpoint as well.
>>>
>>> Application versions:
>>> Camel 2.7.0
>>> Spring 3.0.5.RELEASE
>>>
>>> Any help is appreciated.
>>>
>>> Cheers,
>>>
>>> ~Justin
>>>
>>>
>>>
>>>
>>> CONFIDENTIALITY NOTICE:
>>> The information in this message, and any attachment, is intended for the
>>>
>>> sole use of the individual and entity to whom it is addressed. This
>>> information may be privileged, confidential, and protected from
>>> disclosure. If you are not the intended recipient you are hereby
>>> notified
>>> that you have received this communication in error and that any review,
>>> disclosure, dissemination, distribution or copying of it, or its
>>> contents,
>>> is strictly prohibited. If you think that you have received this message
>>>
>>> in error please notify the sender and destroy all copies of this
>>> communication and any attachments. Thank you.
>>>
>>> CONFIDENTIALITY NOTICE:
>>> The information in this message, and any attachment, is intended for the
>>> sole use of the individual and entity to whom it is addressed. This
>>> information may be privileged, confidential, and protected from
>>> disclosure. If you are not the intended recipient you are hereby notified
>>> that you have received this communication in error and that any review,
>>> disclosure, dissemination, distribution or copying of it, or its contents,
>>> is strictly prohibited. If you think that you have received this message
>>> in error please notify the sender and destroy all copies of this
>>> communication and any attachments. Thank you.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cib...@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>> CONFIDENTIALITY NOTICE:
>> The information in this message, and any attachment, is intended for the
>> sole use of the individual and entity to whom it is addressed. This
>> information may be privileged, confidential, and protected from
>> disclosure. If you are not the intended recipient you are hereby notified
>> that you have received this communication in error and that any review,
>> disclosure, dissemination, distribution or copying of it, or its contents,
>> is strictly prohibited. If you think that you have received this message
>> in error please notify the sender and destroy all copies of this
>> communication and any attachments. Thank you.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>
> CONFIDENTIALITY NOTICE:
> The information in this message, and any attachment, is intended for the
> sole use of the individual and entity to whom it is addressed. This
> information may be privileged, confidential, and protected from
> disclosure. If you are not the intended recipient you are hereby notified
> that you have received this communication in error and that any review,
> disclosure, dissemination, distribution or copying of it, or its contents,
> is strictly prohibited. If you think that you have received this message
> in error please notify the sender and destroy all copies of this
> communication and any attachments. Thank you.



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

CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.

CONFIDENTIALITY NOTICE:
The information in this message, and any attachment, is intended for the 
sole use of the individual and entity to whom it is addressed. This 
information may be privileged, confidential, and protected from 
disclosure. If you are not the intended recipient you are hereby notified 
that you have received this communication in error and that any review, 
disclosure, dissemination, distribution or copying of it, or its contents, 
is strictly prohibited. If you think that you have received this message 
in error please notify the sender and destroy all copies of this 
communication and any attachments. Thank you.

Reply via email to