Hi Camel-Users,
Can anyone give any hints on using @Consumed annotation. I have written a
sample application where
1. Polling JPAConsumer endpoint gets new record
2. Message translation using Bean Integration to invoke the method.
3. Work in progress - I am trying to figure out how to use @Consumed to mark
that the row has been processed so it won't be queried again. Any hints or
guidance on using @Consumed will be greatly appreciated..
++++++ RouteBuilder +++++++
public class testRouter extends SpringRouteBuilder {
@Override
public void configure() throws Exception {
// the following will dump the database to files
from("jpa:com.test.entity.OldTableEntity?consumeDelete=false&delay=3000&consumeLockEntity=false")
.to("bean:testTransformerBean?method=checkIfLookupValueExist");
}
}
++++++++++++
+++++Entity class ++++
@Entity
@Table(name = "test_table")
public class OldTableEntity {
@Column(name ="displayID")
private String displayID;
@Column(name ="userName")
private String userName;
@Column(name ="ordType")
...
getter and setters...
}
++++++++++++++
+++++ camel context ++++++++
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<package>com.test</package>
</camelContext>
<bean id = "testTransformerBean" class
="com.test.transformation.testTransformer"/>
<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="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="camel"/>
</bean>
</beans>
+++
Kind regards,
-Vid-
--
View this message in context:
http://old.nabble.com/%40Consumed-tp27026797p27026797.html
Sent from the Camel - Users mailing list archive at Nabble.com.