3 Replies Latest reply on Mar 28, 2011 8:27 AM by Raj Kapoor

    Please tell of how to use @Consumed annotation when consuming from JPA??

    Raj Kapoor Newbie

      Hi All,

       

      I'm sure this is a common question, and I know this as I have just done a google search on it, and find many people asking this question, but no one really responds with an actual (short, ie 4 lines or so) example, of how to do it. Even Camel In Action has no examples or discussion of how to do this.

      When Consuming from a JPA endpoint, the default behaviour is that the row will be deleted from the DB after it is consumed. You can set (consumeDelete=false) to leave the row there even after it has been consumed.

      However, this means that the continuous polling of the JPA endpoint will eventually (depending on the polling delay), bring these same rows back again for processing again. This is not what I want.

      I want the rows to remain there, but also, to be marked with one column (call it 'processed') set to Y, from N previously etc etc. I understand that this can be done using the @Consumed annotation. However, there are absolutely no examples of this code anywhere.

      Can some one please just provide some? Apologies, I am new to Camel, and have not read Camel In Action from cover to cover yet, although it seems a great book.

       

      Also, another question I have are:

      - We are planning on using Camel. We will mainly consume from JPA endpoints and produce to JMS endpoints. In terms of JPA, are there any suggestions on which is better , Hibernate or OpenJPA? Any input is appreciated? (Or should we totally forget JPA altogether and just use JDBC. Has Camel been coded to work better with JDBC endpoints rather than JPA?)

       

      Many Thanks for any help offered.