You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Justin Rosenberg <Ro...@crlcorp.com> on 2011/12/07 02:46:42 UTC

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.

Re: Mail component ContentTypeResolver SPI customization

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Dec 7, 2011 at 4:22 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Dec 7, 2011 at 4:17 PM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
>> I am receiving an e-mail with a PDF attachment, however the dh.getContentType() is returning [APPLICATION/OCTET-STREAM; name="file.pdf"] as opposed to the more preferable [application/pdf; name="file.pdf"].
>>
>> I'm can get this to work by manually passing the filename to a MimetypesFileTypeMap instance or since I'm using Spring I will probably use org.springframework.mail.javamail.ConfigurableMimeFileTypeMap instead.
>>
>> Thanks for your dedication to this project.  It's always nice to see a quick response on a usergroup forum!
>>
>
> Thanks for sharing your use case. We could possible improve camel-mail
> to use the custom ContentTypeResolver when receiving emails as well.
> As its seems like a fast way to be in control of this.
>

Just for the record. I logged a JIRA ticket
https://issues.apache.org/jira/browse/CAMEL-4750

>
>
>> ~Justin
>>
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
>> Sent: Wednesday, December 07, 2011 12:58 AM
>> To: users@camel.apache.org
>> Subject: Re: Mail component ContentTypeResolver SPI customization
>>
>> Hi
>>
>> The ContentTypeResolver is used when *sending* emails. It was
>> introduced to work around issues with  the Geronimo Mail
>> Implementation.
>> The SUN Mail Provider works fine, so the resolver shouldn't really be
>> needed anymore.
>>
>> What's your use case to use the ContentTypeResolver ?
>>
>>
>> On Wed, Dec 7, 2011 at 2:46 AM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
>>> 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.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@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: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



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

Re: Mail component ContentTypeResolver SPI customization

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Dec 7, 2011 at 4:17 PM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
> I am receiving an e-mail with a PDF attachment, however the dh.getContentType() is returning [APPLICATION/OCTET-STREAM; name="file.pdf"] as opposed to the more preferable [application/pdf; name="file.pdf"].
>
> I'm can get this to work by manually passing the filename to a MimetypesFileTypeMap instance or since I'm using Spring I will probably use org.springframework.mail.javamail.ConfigurableMimeFileTypeMap instead.
>
> Thanks for your dedication to this project.  It's always nice to see a quick response on a usergroup forum!
>

Thanks for sharing your use case. We could possible improve camel-mail
to use the custom ContentTypeResolver when receiving emails as well.
As its seems like a fast way to be in control of this.



> ~Justin
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
> Sent: Wednesday, December 07, 2011 12:58 AM
> To: users@camel.apache.org
> Subject: Re: Mail component ContentTypeResolver SPI customization
>
> Hi
>
> The ContentTypeResolver is used when *sending* emails. It was
> introduced to work around issues with  the Geronimo Mail
> Implementation.
> The SUN Mail Provider works fine, so the resolver shouldn't really be
> needed anymore.
>
> What's your use case to use the ContentTypeResolver ?
>
>
> On Wed, Dec 7, 2011 at 2:46 AM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
>> 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.
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: Mail component ContentTypeResolver SPI customization

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
I am receiving an e-mail with a PDF attachment, however the dh.getContentType() is returning [APPLICATION/OCTET-STREAM; name="file.pdf"] as opposed to the more preferable [application/pdf; name="file.pdf"].

I'm can get this to work by manually passing the filename to a MimetypesFileTypeMap instance or since I'm using Spring I will probably use org.springframework.mail.javamail.ConfigurableMimeFileTypeMap instead.

Thanks for your dedication to this project.  It's always nice to see a quick response on a usergroup forum!

~Justin


-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Wednesday, December 07, 2011 12:58 AM
To: users@camel.apache.org
Subject: Re: Mail component ContentTypeResolver SPI customization

Hi

The ContentTypeResolver is used when *sending* emails. It was
introduced to work around issues with  the Geronimo Mail
Implementation.
The SUN Mail Provider works fine, so the resolver shouldn't really be
needed anymore.

What's your use case to use the ContentTypeResolver ?


On Wed, Dec 7, 2011 at 2:46 AM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
> 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.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@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.

Re: Mail component ContentTypeResolver SPI customization

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The ContentTypeResolver is used when *sending* emails. It was
introduced to work around issues with  the Geronimo Mail
Implementation.
The SUN Mail Provider works fine, so the resolver shouldn't really be
needed anymore.

What's your use case to use the ContentTypeResolver ?


On Wed, Dec 7, 2011 at 2:46 AM, Justin Rosenberg <Ro...@crlcorp.com> wrote:
> 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.



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

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
Does the File and Email endpoint require a JMS transaction provider to
do transactions or can it use JTA instead?

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

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.

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
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:RosenbergJ@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.ibsen@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
<Ro...@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.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@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.

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
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.ibsen@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
<Ro...@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.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@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.

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
That explains it.  It turns out in this case I unintentionally instructed Camel to load a Spring file with a defined JMSTransactionHandler.  Even though the file/mail endpoint doesn't participate with transactions, since Camel saw "transacted()" it found the JMSTransactionHandler definition and tried to use it which it couldn't because I didn't have a broker defined on the server.

So, in short, to achieve the "pseudo transactional" support I was looking for, I just needed to remove the ".transacted()" and make sure that the error handler set ".handled(false)".

Thank you for expedient help in figuring out what I did wrong.

Cheers,



~Justin


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

Hi

You should not have transacted in the Camel route if you do not use
JMS or JDBC etc.


On Fri, Dec 16, 2011 at 6:16 PM, Justin Rosenberg
<Ro...@crlcorp.com> wrote:
> I'm not sure why my JTA is trying to use JMS Transaction.  I will do some digging.  This is what I have in Spring.
>
>        <!-- JTA Transaction Management -->
>        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
>                <property name="transactionManagerName" value="java:/TransactionManager" />
>                <property name="allowCustomIsolationLevels" value="true" />
>        </bean>
>
> Thanks for your help.
>
> ~Justin
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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.ibsen@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
>>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@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: cibsen@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.

Re: Email and File .transacted()

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You should not have transacted in the Camel route if you do not use
JMS or JDBC etc.


On Fri, Dec 16, 2011 at 6:16 PM, Justin Rosenberg
<Ro...@crlcorp.com> wrote:
> I'm not sure why my JTA is trying to use JMS Transaction.  I will do some digging.  This is what I have in Spring.
>
>        <!-- JTA Transaction Management -->
>        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
>                <property name="transactionManagerName" value="java:/TransactionManager" />
>                <property name="allowCustomIsolationLevels" value="true" />
>        </bean>
>
> Thanks for your help.
>
> ~Justin
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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.ibsen@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
>>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
I'm not sure why my JTA is trying to use JMS Transaction.  I will do some digging.  This is what I have in Spring.

	<!-- JTA Transaction Management -->
	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManagerName" value="java:/TransactionManager" />
		<property name="allowCustomIsolationLevels" value="true" />
	</bean>

Thanks for your help.

~Justin


-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@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
<Ro...@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.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@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.

Re: Email and File .transacted()

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 16, 2011 at 5:59 PM, Justin Rosenberg
<Ro...@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.ibsen@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
> <Ro...@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.ibsen@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
>> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
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.

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.ibsen@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
<Ro...@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.ibsen@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
> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@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.

Re: Email and File .transacted()

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 16, 2011 at 5:46 PM, Justin Rosenberg
<Ro...@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.ibsen@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
> <Ro...@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:RosenbergJ@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: cibsen@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
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...

~Justin


-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@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
<Ro...@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:RosenbergJ@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: cibsen@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.

Re: Email and File .transacted()

Posted by Claus Ibsen <cl...@gmail.com>.
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
<Ro...@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:RosenbergJ@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Email and File .transacted()

Posted by Justin Rosenberg <Ro...@crlcorp.com>.
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:RosenbergJ@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.