Re: JPA component and JTA

2012-10-07 Thread Christian Müller
You can find a working example with Bitronix here [1].

[1] https://github.com/muellerc/camel-in-transaction

Best,
Christian

On Sat, Oct 6, 2012 at 9:19 AM, Babak Vahdat wrote:

> Hi
>
> Setting up JTA is not that easy. Have you verified that Bitronix can
> properly "talk" with your JDBC driver? Is your Database driver already
> XA-capable, that's does it provide any javax.sql.XADataSource
> implementation? If not it will not participate in a global rollback even if
> Bitronix asks it to do so.
>
> Bitronix also provides XADataSource wrappers in case you database driver is
> not XA-capable (check the Bitronix documentation for
> bitronix.tm.resource.jdbc.lrc.LrcXADataSource). Another possible option
> could be to also give Atomikos a try.
>
> Maybe you also want to check the Camel XA samples of Christian Müller:
>
>
> https://github.com/muellerc/camel-in-transaction/tree/master/src/test/java/org/apache/cmueller/camel/samples/camelone/xa
>
> Babak
>
>
> Lucas Amador wrote
> > Thanks for the point! Now the transaction manager seems to be *working*
> > but when an exception is throwed the rollback doesn't seem to be
> executed.
> >
> > well, I see the next lines in console
> >
> > org.spring.spi.TransactionErrorHandler.processInTransaction - Transaction
> > begin (0x3643b5bb) for ExchangeId: ID-lucaz-62564-1349462154706-0-1
> > Hibernate: select myCustomSequence.nextval from dual
> > Hibernate: insert into Person (id, name) values (?, ?)
> > // Exception throwed and delivery attempts
> > org.spring.spi.TransactionErrorHandler.processInTransaction - Transaction
> > rollback (0x3643b5bb) for ExchangeId: ID-lucaz-62564-1349462154706-0-1
> due
> > exception: java.lang.Exception
> >
> >
> > but the Person entity stills being persisted in the database. Am I
> missing
> > something?
> > 
> >
> > 
> >
> > 
> > java.lang.Exception
> > 
> >
> > 
> > 
> >
> > 
> >
> > 
> >
> > 
> >
> >  > uri="jpa:com.example.Person?transactionManager=#jtaTransactionManager" />
> >
> > 
> > 
> >
> >
> > --
> > Lucas Amador
> >
> >
> > On Friday, October 5, 2012 at 11:08 AM, Babak Vahdat wrote:
> >
> >> Hi
> >>
> >> I've updated the Wiki to be clear about this (needs couple of minutes to
> >> be
> >> synced with the website):
> >>
> >>
> http://camel.465427.n5.nabble.com/CONF-Apache-Camel-gt-JPA-td5720613.html
> >>
> >> Babak
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://camel.465427.n5.nabble.com/JPA-component-and-JTA-tp5720611p5720614.html
> >> Sent from the Camel - Users mailing list archive at Nabble.com
> >> (http://Nabble.com).
> >>
> >>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JPA-component-and-JTA-tp5720611p5720662.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--


Re: Mail reading goes in loop

2012-10-07 Thread Ketan Barapatre
Thank you for reply. I will try all possible solutions and update with
result.

Thank you
Ketan
On Oct 6, 2012 12:41 PM, "Claus Ibsen"  wrote:

> Hi
>
> You would need to use the idempotent consumer EIP to filter out duplicates
> etc
> http://camel.apache.org/idempotent-consumer.html
>
> Otherwise you would need to either delete or mark the mails as seen on
> the mail server, so on next poll
> the previous mails is not consumed again.
>
>
>
> On Fri, Oct 5, 2012 at 7:41 PM, Ketan Barapatre
>  wrote:
> > Hello All,
> >
> > I am reading mail using Mail Component http://camel.apache.org/mail.html
> >
> > I have created following Route
> >
> > from("imaps://imap.gmail.com?username=" + user.getUserName() +
> "&password="
> > + user.getPassword()
> > +
> >
> "&unseen=false&fetchSize=10&consumer.delay=100").filter(messageFilter).process(mailProcessor);
> >
> > Now, I am expecting to get all read and unread mails from INBOX
> > folder. When I run my app I am able to get all read and unread mail from
> > INBOX but
> > Mail reading starts from very first mail(from INBOX) and when last
> > mail(latest mail from INBOX) is fetch it again starts reading mail from
> > first mail(from INBOX) but I am expecting it should stop after reading
> last
> > mail (which is latest mail) from INBOX. So I found that Polling to INBOX
> > start again it goes in loop.
> >
> > Please suggest me How can I stop looping when mail reading is done.
> > Or is there any way I can poll my mail box to get mail only from
> specified
> > start date upto specified end date or
> >
> > Please correct me if i'm not clear with question or suggest me How can do
> > this.
> >
> > Thank You
> > Ketan
>
>
>
> --
> Claus Ibsen
> -
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>


Re: Camel Tracer example - Database

2012-10-07 Thread Gnanaguru S

Hello Christian,

After verifying with Derby. I altered the configuration in persistence.xml
for derby. Now the application is connected with Derby. I can see the
connectivity log. 

But when I run the example, Tracer was not able to store the message into
the database. It throws this error message. Please let me know your
thoughts.

2012-10-08 11:29:32,869 [2 - stream://in] INFO  SchemaExport  
- Running hbm2ddl schema export
2012-10-08 11:29:32,869 [2 - stream://in] INFO  SchemaExport  
- exporting generated schema to database
2012-10-08 11:29:33,070 [2 - stream://in] INFO  SchemaExport  
- schema export complete
2012-10-08 11:29:33,568 [read #3 - Split] WARN  JDBCExceptionReporter 
- SQL Error: 2, SQLState: XSDA4
2012-10-08 11:29:33,568 [read #3 - Split] ERROR JDBCExceptionReporter 
- An unexpected exception was thrown
2012-10-08 11:29:33,568 [read #3 - Split] WARN  JDBCExceptionReporter 
- SQL Error: 0, SQLState: XJ001
2012-10-08 11:29:33,569 [read #3 - Split] ERROR JDBCExceptionReporter 
- Java exception: 'A truncation error was encou
ntered trying to shrink CLOB '' to length 255.:
org.apache.derby.iapi.services.io.DerbyIOException'.
2012-10-08 11:29:33,573 [read #3 - Split] ERROR DefaultTraceEventHandler  
- Error processing trace event (original Exchan
ge will continue): Exchange[Message:
TraceEventMessage[ID-D-113042471-63072-1349675952241-0-4] on node:
bean://quoteService?me
thod=quote]
org.springframework.orm.jpa.JpaSystemException:
org.hibernate.exception.GenericJDBCException: could not insert:
[org.apache.ca
mel.processor.interceptor.jpa.JpaTraceEventMessage]; nested exception is
javax.persistence.PersistenceException: org.hibernate
.exception.GenericJDBCException: could not insert:
[org.apache.camel.processor.interceptor.jpa.JpaTraceEventMessage]
at
org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils
.java:321)[spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at
org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:120)[spring-orm-3
.0.7.RELEASE.jar:3.0.7.RELEASE]
at
org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)[spring-tx-3.0.7.RELE
ASE.jar:3.0.7.RELEASE]
at
org.springframework.orm.jpa.JpaAccessor.translateIfNecessary(JpaAccessor.java:152)[spring-orm-3.0.7.RELEASE.jar:3.0
.7.RELEASE]
at
org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:188)[spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at
org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146)[spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
at
org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1.doInTransaction(JpaTemplateTransactionStrategy.java
:80)[camel-jpa-2.10.0.jar:2.10.0]
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)[spring-tx-3.0.7.R
ELEASE.jar:3.0.7.RELEASE]
at
org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78)[camel
-jpa-2.10.0.jar:2.10.0]
at
org.apache.camel.component.jpa.JpaProducer.process(JpaProducer.java:50)[camel-jpa-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.interceptor.DefaultTraceEventHandler.traceExchange(DefaultTraceEventHandler.java:117)[ca
mel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.interceptor.TraceInterceptor.traceExchange(TraceInterceptor.java:291)[camel-core-2.10.0.
jar:2.10.0]
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:151)[camel-core-2.10.0.jar:2.
10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)[camel-core-2
.10.0.jar:2.10.0]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[camel-core-2.10.0.jar:2.
10.0]
at
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)[camel-core-2.10.0.jar:2
.10.0]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[camel-core-2.10.0.jar:2.1
0.0]
at
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303)[camel-core-2.10.0.jar:2.10.0
]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.10.0.jar:2.10.0]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[camel-core-2.10.0.ja