|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Can not consume JPA ObjectHi,
when I try to consume a database object (JPA - openJPA) within the following route (RouteBuilder) ... public void configure() { onException(Exception.class) .maximumRedeliveries(-1).redeliveryDelay(1000) .handled(true) .bean(LogExceptionBean.class,"logException") .rollback() .end(); from("jpa:com.itellium.eai.store.schema.entity.Customer?consumer.namedQuery=findAll&delay=10000&consumeLockEntity=true&consumeDelete=true") .id("jpaIn") .transacted() .bean(LogBean.class,"logMessage") .to("jms:jpaIn?jmsMessageType=Object") .end(); } ... the object is deleted in the database but never published to the destination queue (JMS - ActiveMQ)! I've got no exception (loglevel is INFO) at all. Breakpoints in LogBean.logMessage or LogExceptionBean.logException are never reached. When I enable tracing for the route (in jconsole) I get the following ... 2009-10-27 08:31:54,906 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> from(jpa://com.itellium.eai.store.schema.entity.Customer?consumeDelete=false&consumeLockEntity=true&consumer.namedQuery=findAll&delay=10000) -->, Pattern:InOnly, Headers:{CamelRedelivered=true, CamelRedeliveryCounter=29, CamelBeanMultiParameterArray=false, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelBeanMethodName=logMessage}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) 2009-10-27 08:31:54,909 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> from(jpa://com.itellium.eai.store.schema.entity.Customer?consumeDelete=false&consumeLockEntity=true&consumer.namedQuery=findAll&delay=10000) -->, Pattern:InOnly, Headers:{CamelRedeliveryCounter=29, CamelBeanMethodName=logMessage, CamelBeanMultiParameterArray=false, CamelRedelivered=true, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] 2009-10-27 08:31:55,913 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelBeanMultiParameterArray=false, CamelRedeliveryCounter=30, CamelRedelivered=true, CamelBeanMethodName=logMessage, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) 2009-10-27 08:31:55,914 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelBeanMethodName=logMessage, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelBeanMultiParameterArray=false, CamelRedelivered=true, CamelRedeliveryCounter=30}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] 2009-10-27 08:31:56,916 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelRedelivered=true, CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, CamelRedeliveryCounter=31, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) 2009-10-27 08:31:56,917 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelRedeliveryCounter=31, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, CamelRedelivered=true}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] 2009-10-27 08:31:57,918 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelRedelivered=true, CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelRedeliveryCounter=32}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) 2009-10-27 08:31:57,920 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelBeanMultiParameterArray=false, CamelRedelivered=true, CamelBeanMethodName=logMessage, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelRedeliveryCounter=32}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] 2009-10-27 08:31:58,922 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelBeanMultiParameterArray=false, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelRedelivered=true, CamelBeanMethodName=logMessage, CamelRedeliveryCounter=33}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) 2009-10-27 08:31:58,923 [1: JpaComponent] INFO Tracer - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, Headers:{CamelRedelivered=true, CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, CamelRedeliveryCounter=33}, BodyType:com.itellium.eai.store.schema.entity.Customer, Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), Exception: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] ... and so on. Any ideas ... ? ... DRy |
|
|
Re: Can not consume JPA ObjectHi
You have an exception occuring. Can you log exception bean not see this exception? Since you use handled(true) the exception is cleared from the Exchange. You have to get hold of it from a property Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class); And you do a unlimited redeliver. I would assume the JPA consumer will just try again on next poll. So you can just do this to log the exception onException(Exception.class) .bean(LogExceptionBean.class,"logException") .end(); On Tue, Oct 27, 2009 at 8:50 AM, DRy <dirk.rybinski@...> wrote: > > Hi, > > when I try to consume a database object (JPA - openJPA) within the following > route (RouteBuilder) ... > > public void configure() { > > onException(Exception.class) > .maximumRedeliveries(-1).redeliveryDelay(1000) > .handled(true) > .bean(LogExceptionBean.class,"logException") > .rollback() > .end(); > > > from("jpa:com.itellium.eai.store.schema.entity.Customer?consumer.namedQuery=findAll&delay=10000&consumeLockEntity=true&consumeDelete=true") > .id("jpaIn") > .transacted() > .bean(LogBean.class,"logMessage") > .to("jms:jpaIn?jmsMessageType=Object") > .end(); > } > > ... the object is deleted in the database but never published to the > destination queue (JMS - ActiveMQ)! I've got no exception (loglevel is INFO) > but when I enable tracing for the route (in jconsole) I get the following > ... > > 2009-10-27 08:31:54,906 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> > from(jpa://com.itellium.eai.store.schema.entity.Customer?consumeDelete=false&consumeLockEntity=true&consumer.namedQuery=findAll&delay=10000) > -->, Pattern:InOnly, Headers:{CamelRedelivered=true, > CamelRedeliveryCounter=29, CamelBeanMultiParameterArray=false, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelBeanMethodName=logMessage}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) > 2009-10-27 08:31:54,909 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> > from(jpa://com.itellium.eai.store.schema.entity.Customer?consumeDelete=false&consumeLockEntity=true&consumer.namedQuery=findAll&delay=10000) > -->, Pattern:InOnly, Headers:{CamelRedeliveryCounter=29, > CamelBeanMethodName=logMessage, CamelBeanMultiParameterArray=false, > CamelRedelivered=true, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), > Exception: org.apache.camel.CamelExecutionException: Exception occurred > during execution on the exchange: Exchange[Message: > com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] > 2009-10-27 08:31:55,913 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelBeanMultiParameterArray=false, CamelRedeliveryCounter=30, > CamelRedelivered=true, CamelBeanMethodName=logMessage, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) > 2009-10-27 08:31:55,914 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelBeanMethodName=logMessage, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelBeanMultiParameterArray=false, CamelRedelivered=true, > CamelRedeliveryCounter=30}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), > Exception: org.apache.camel.CamelExecutionException: Exception occurred > during execution on the exchange: Exchange[Message: > com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] > 2009-10-27 08:31:56,916 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelRedelivered=true, CamelBeanMultiParameterArray=false, > CamelBeanMethodName=logMessage, CamelRedeliveryCounter=31, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) > 2009-10-27 08:31:56,917 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelRedeliveryCounter=31, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, > CamelRedelivered=true}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), > Exception: org.apache.camel.CamelExecutionException: Exception occurred > during execution on the exchange: Exchange[Message: > com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] > 2009-10-27 08:31:57,918 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelRedelivered=true, CamelBeanMultiParameterArray=false, > CamelBeanMethodName=logMessage, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelRedeliveryCounter=32}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) > 2009-10-27 08:31:57,920 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelBeanMultiParameterArray=false, CamelRedelivered=true, > CamelBeanMethodName=logMessage, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelRedeliveryCounter=32}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), > Exception: org.apache.camel.CamelExecutionException: Exception occurred > during execution on the exchange: Exchange[Message: > com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] > 2009-10-27 08:31:58,922 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelBeanMultiParameterArray=false, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelRedelivered=true, CamelBeanMethodName=logMessage, > CamelRedeliveryCounter=33}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1) > 2009-10-27 08:31:58,923 [1: JpaComponent] INFO Tracer > - 4c83b6d7-4cc0-48fa-b571-261a7b949c90 >>> -->, Pattern:InOnly, > Headers:{CamelRedelivered=true, > CamelJpaTemplate=org.springframework.orm.jpa.JpaTemplate@1fba15d, > CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage, > CamelRedeliveryCounter=33}, > BodyType:com.itellium.eai.store.schema.entity.Customer, > Body:com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1), > Exception: org.apache.camel.CamelExecutionException: Exception occurred > during execution on the exchange: Exchange[Message: > com.itellium.eai.store.schema.entity.Customer@1e335d7(oid=1,name=Name1,oversion=1)] > > ... and so on. > > Any ideas ... ? > > > ... DRy > -- > View this message in context: http://www.nabble.com/Can-not-consume-JPA-Object-tp26073512p26073512.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus |
|
|
Re: Can not consume JPA ObjectHi,
Yes. In case of an exception the database object should be rolled back and unlimited re-consumed the next poll. Yes, there was an exception within Logbean (my fault). But the LogExceptionbean was never reached. Yes, this is implemented in LogEceptionBean. If I do not use handled(true) I endup in DeathLetter-ErrorHandler ... ... DRy |
| Free embeddable forum powered by Nabble | Forum Help |