Hi

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 <[email protected]> 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.jpatempl...@1fba15d,
> CamelBeanMethodName=logMessage},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.jpatempl...@1fba15d},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.custo...@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.jpatempl...@1fba15d},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.jpatempl...@1fba15d,
> CamelBeanMultiParameterArray=false, CamelRedelivered=true,
> CamelRedeliveryCounter=30},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.custo...@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.jpatempl...@1fba15d},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.jpatempl...@1fba15d,
> CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage,
> CamelRedelivered=true},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.custo...@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.jpatempl...@1fba15d,
> CamelRedeliveryCounter=32},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.jpatempl...@1fba15d,
> CamelRedeliveryCounter=32},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.custo...@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.jpatempl...@1fba15d,
> CamelRedelivered=true, CamelBeanMethodName=logMessage,
> CamelRedeliveryCounter=33},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.jpatempl...@1fba15d,
> CamelBeanMultiParameterArray=false, CamelBeanMethodName=logMessage,
> CamelRedeliveryCounter=33},
> BodyType:com.itellium.eai.store.schema.entity.Customer,
> Body:com.itellium.eai.store.schema.entity.custo...@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.custo...@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

Reply via email to