Using a JPA based idempotent repository

来源:互联网 发布:全民tv淘宝权直播间 编辑:程序博客网 时间:2024/06/05 19:58

 

List archives
Videos
Answers

Using a JPA based idempotent repository ~

Re: SMTP Attachment filename
(7 lines)Nov 15, 2010Awold
Awold
Tweet
I’ve been trying to set up a working example of using a jpa store for
idempotent file handling with Hibernate and it’s not quite working.
I’m
currently using an H2 database. Everything seems to start up fine until it
tries to persist the message processed entity (that's #4 below). But I
also
have some general questions too.


1) Am I forced to use OpenJPA? My project uses Hibernate and thus I’ll
already have an entity manager created, etc.


2) CAMEL_MESSAGEPROCESSED and OPENJPA_SEQUENCE_TABLE tables are created
automatically but nothing was in the OPENJPA_SEQUENCE_TABLE table. Should
a
record have been created automatically in this table?


3) Having CAMEL_MESSAGEPROCESSED and OPENJPA_SEQUENCE_TABLE tables created
automatically in a production db is probably not going to fly. What would
be the best approach to creating DDL statements for these tables? I
downloaded the Apache Camel 2.5.0 and did not find any creation scripts. I
understand that the DDL script could vary by DB, but it seems like this
could be a common issue so an ANSI SQL compliant DDL script could/should be
shipped I would think.


4) Here is the error I’m receiving. Why isn’t ID being generated? In
my
console I see a select against CAMEL_MESSAGEPROCESSED, then an insert. But
never an operation against OPENJPA_SEQUENCE_TABLE to generate an ID.




2010-11-15 09:52:54,347 [B2BClinicalData] DEBUG GenericFileOnCompletion

- Done processing file: GenericFile[Doc 1.txt] using exchange:
Exchange[Message: GenericFile[Doc 1.txt]]

2010-11-15 09:52:54,347 [B2BClinicalData] DEBUG SQL

- select messagepro0_.id as id0_, messagepro0_.messageId as messageId0_,
messagepro0_.processorName as processo3_0_ from CAMEL_MESSAGEPROCESSED
messagepro0_ where messagepro0_.processorName=? and
messagepro0_.messageId=?

2010-11-15 09:52:54,362 [B2BClinicalData] TRACE StringType

- binding 'FileConsumer' to parameter: 1

2010-11-15 09:52:54,362 [B2BClinicalData] TRACE StringType

- binding 'Doc 1.txt' to parameter: 2

2010-11-15 09:52:54,378 [B2BClinicalData] DEBUG SQL

- insert into CAMEL_MESSAGEPROCESSED (id, messageId, processorName) values
(null, ?, ?)

2010-11-15 09:52:54,378 [B2BClinicalData] TRACE StringType

- binding 'Doc 1.txt' to parameter: 1

2010-11-15 09:52:54,378 [B2BClinicalData] TRACE StringType

- binding 'FileConsumer' to parameter: 2

2010-11-15 09:52:54,394 [B2BClinicalData] WARN JDBCExceptionReporter

- SQL Error: 90006, SQLState: 90006

2010-11-15 09:52:54,394 [B2BClinicalData] ERROR JDBCExceptionReporter

- NULL not allowed for column "ID"; SQL statement:
insert into CAMEL_MESSAGEPROCESSED (id, messageId, processorName) values
(null, ?, ?) [90006-144]






<persistence-unit name="samplePU" transaction-type="RESOURCE_LOCAL">

<class>org.apache.camel.processor.idempotent.jpa.MessageProcessed</class>
</persistence-unit>




<bean id="transactionTemplate"
class="org.springframework.transaction.support.TransactionTemplate">
<property name="transactionManager">
<bean
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory"
ref="entityManagerFactory"/>
</bean>
</property>
</bean>

<bean id="dbDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:tcp://localhost/~/test;USER=sa"
/>
<property name="username" value="sa" />
<property name="password" value="" />
</bean>

<bean id="jpaTemplate"
class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory"
ref="entityManagerFactory"/>
</bean>

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dbDataSource" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="${ecdi_db.type}" />
<property name="showSql" value="false" />
<property name="generateDdl" value="false" />
</bean>
</property>
</bean>

<bean id="jpaStore"
class="org.apache.camel.processor.idempotent.jpa.JpaMessageIdRepository">
<constructor-arg index="0" ref="jpaTemplate"/>
<constructor-arg index="1" value="FileConsumer"/>
</bean>





Reply
  • mid
  • Similar news articles
  • Similar web forums threads
Similar Threads
  • Created: (MRM-1421) Archiva repository purge incorrectly purges based on file timestamps even when t
  • ftp2 - idempotent feature
  • File : recursive + noop = no more idempotent
  • Created: (HTTPCLIENT-989) DefaultHttpRequestRetryHandler must not retry non-idempotent http methods
  • Created: (CAMEL-2886) idempotent consumer EIP to support non blocking routing engine
  • Created: (FELIX-2564) Repository view should show progress bar when refreshing repository contents
  • Created: (MRM-1417) Add basic managed repository management support on adding repository, deleting r
  • Help publishing from one repository to another repository
  • content based routing based on header value
  • IP based node sections instead of hostname based?
  • svn commit: r987242 - in /httpd/httpd/trunk/docs/manual/vhosts: ip-based.xml name-based.xml
  • Re: accessing repository
  • private repository
  • Changes to repository locations
  • How to get a copy of repository?
  • A few notes on new repository API
  • Repository purge
  • Repository configuration
  • Restructure jdo repository
  • accessing repository
Created: (MRM-1421) Archiva repository purge incorrectly purges based on file timestamps even when t
Archiva repository purge incorrectly purges based on file timestampseven when the snapshot timestamp is known
ftp2 - idempotent feature
Hello everyone, I am new to the camel developers mailing list. I amcurrently trying to use the ftp component in the camel 2.4.0 andtrying to use the idempotent feature to not iterate over alreadyprocessed files. The ftp2 component's document…
File : recursive + noop = no more idempotent
When mounting this route from("file://C:/XXXX/?noop=true").to("xxxxProcessor"); Only new filesmessage are send to the Processor but when using from("file://C:/XXXX?noop=true&recursive=true").to("xxxxProcessor"); all files are send even if…
Created: (HTTPCLIENT-989) DefaultHttpRequestRetryHandler must not retry non-idempotent http methods
DefaultHttpRequestRetryHandler must not retry non-idempotent httpmethods (violates RFC 2616)
Created: (CAMEL-2886) idempotent consumer EIP to support non blocking routing engine
idempotent consumer EIP to support non blocking routing engine
Created: (FELIX-2564) Repository view should show progress bar when refreshing repository contents
Repository view should show progress bar when refreshing repositorycontents
Created: (MRM-1417) Add basic managed repository management support on adding repository, deleting r
Add basic managed repository management support on adding repository,deleting repository, and loading repository by id
Help publishing from one repository to another repository
I'm trying to write a java app that will publish artifacts from onerepository to another. The problem I'm running into seems to becaused by the PublishEngine behavior with respect to revision. Specifically, in my first repository, the revision…
content based routing based on header value
I am setting up a route in XML and want to send messages to adestination based on a field in the header. I have the following: <log message="Analyzed [${body}] with destination -->${header.dest}"/> <choice> …
IP based node sections instead of hostname based?
Hi experts, Is there a way to specify in the nodes.pp sections with the ip address of the client? Currently I only saw instructions to use wildcarded hostnames. Thanks a lot -Yushu +-------------------------------------------------+ | Yushu Yao…
svn commit: r987242 - in /httpd/httpd/trunk/docs/manual/vhosts: ip-based.xml name-based.xml
Author: poirier Date: Thu Aug 19 17:38:18 2010 New Revision: 987242 URL: http://svn.apache.org/viewvc?rev=987242&view=rev Log: Minorcorrections and cleanup in the descriptions of IP-based and name-basedvirtual hosts. Modified: …
Re: accessing repository
It looks like your classpath is missing some jars. The error messageshould look something like this: Unable to access a repository withthe following settings: org.apache.jackrabbit.repository.uri:http://localhost:7402/crx/server The…
private repository
I would like to use Apache Buildr in multiple machines with theminimum network overhead. How can I cache compile.dependencies to acentral machine? Can I use sftp instead of making a private Maven orIvy repository? Thank you for your time, Nikos…
Changes to repository locations
The 2.x codeline is now the main codeline, so as agreed, I've swapped the SVN locations around. The 2.x codeline is now at: https://svn.apache.org/repos/asf/commons/proper/net/trunk If you have an SVN workspace for NET 2, you need to run svn…
How to get a copy of repository?
Hi, I was trying to get a copy of a workspace into anotherrepository with different persistence manager. I expected to bestraightforward, but it proved extensively troubling. First Iexported system view of jcr:root, but it wouldn't import…
A few notes on new repository API
A couple of things I noted down for the new repository API while working on the generic metadata: 1. further improvements on generic metadata: - metadata can be displayed by category (hierarchical) for easier viewing - implement a new…
Repository purge
Using Archiva 1.1.4, I'd like to use the '|repository-purge|' repository scanner; based off of retention count. However, I only want this to apply to one of my three repositories. How can I do this, oris it even possible? Does the…
Repository configuration
Hi all, I have a question about how to configure repository. Atthe time I have a project, which uses jackrabbit as repository. Weneed two folders on jcr, let's say "raw_material" and "output". Therequirement is, each folder should be…
Restructure jdo repository
I'd like to simplify the jdo repository that now contains lots of projects that are no longer being used or maintained. The only projects in trunk that have active development are api and tck. There are a few files that we need to keep, such…
accessing repository
With CRX 2.1, repository =JcrUtils.getRepository(http://localhost:7402/crx/server) provides thefollowing RepositoryException: Unable to access a repository with thefollowing settings: org.apache.jackrabbit.repository.uri:…
Restricting/Allowing Access based on IP.
Jun 7, 2010
What do I add to this code to redirect based on 2 cookie values?
May 8, 2010
DialANetwork Premium VPS from £4.05 /mo, SolusVM, 10% off, France based and more!
Oct 10, 2010
Cloud Based Web Hosting (Amazon, etc) - Minimum Site Size?
Sep 23, 2010
原创粉丝点击