forked from rhtconsulting/fuse-quickstarts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rhtconsulting#30 - Started Updating Camel JPA-JTA Example
- Loading branch information
Bryan Saunders
authored and
Greg Tinsley
committed
Nov 29, 2016
1 parent
e2a495d
commit 1755064
Showing
15 changed files
with
87 additions
and
155 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
...pa_jta/src/main/java/org/redhat/consulting/fusequickstarts/karaf/jpa/route/JpaRoutes.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
karaf/camel-jpa_jta/src/main/resources/OSGI-INF/blueprint/blueprint.xml
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
karaf/camel-jpa_jta/src/main/resources/datasources/oracle-ds.xml
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
karaf/camel-jpa_jta/src/main/resources/datasources/postgresql-ds.xml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
19 changes: 12 additions & 7 deletions
19
...a/src/main/resources/scripts/deploy.karaf → karaf/jpa_jta/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
# important! "connector" feature required to have rollback to work | ||
features:install jndi jpa hibernate camel-jpa transaction connector | ||
Build Application | ||
|
||
install -s wrap:mvn:org.postgresql/postgresql/9.3-1102-jdbc41 | ||
Start Fuse | ||
|
||
install -s blueprint:mvn:com.redhat.consulting.fusequickstarts.karaf/camel-jpa-jta/6.2.1/xml/postgres | ||
install -s mvn:com.redhat.consulting.fusequickstarts.karaf/camel-jpa-jta/6.2.1 | ||
Install Dependencies | ||
```` | ||
features:install jndi jpa hibernate camel-jpa transaction connector | ||
install -s mvn:com.h2database/h2/1.3.163 | ||
install -s blueprint:mvn:com.redhat.consulting.fusequickstarts.karaf/camel-jpa-jta/6.2.1/xml/h2 | ||
```` | ||
|
||
la -l | tail | ||
echo JPA Example installed. | ||
Install Application | ||
```` | ||
install -s mvn:com.redhat.consulting.fusequickstarts.karaf/camel-jpa-jta/6.2.1 | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
37 changes: 37 additions & 0 deletions
37
...pa_jta/src/main/java/org/redhat/consulting/fusequickstarts/karaf/jpa/route/JpaRoutes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.redhat.consulting.fusequickstarts.karaf.jpa.route; | ||
|
||
import org.redhat.consulting.fusequickstarts.karaf.jpa.model.Person; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.redhat.consulting.fusequickstarts.karaf.jpa.processor.ExceptionProcessor; | ||
|
||
public class JpaRoutes extends RouteBuilder { | ||
|
||
@Override | ||
public void configure() throws Exception { | ||
from("timer://jpaTimer?fixedRate=true&period=5000&repeatCount=1") | ||
.routeId("Success Route") | ||
.transacted() | ||
.log(">>> Generating New Person") | ||
.setBody(constant(new Person(1, Person.generateName()))) | ||
.log(">>> Saving Person") | ||
.to("jpa://org.redhat.consulting.fusequickstarts.karaf.jpa.model.Person") | ||
.log(">>> Saved Person: ${body}!"); | ||
|
||
from("jpa://org.redhat.consulting.fusequickstarts.karaf.jpa.model.Person") | ||
.routeId("JPA Poll") | ||
.log("Retrieved Person: ${body}"); | ||
|
||
/*from("timer://jpaTimer?fixedRate=true&period=5000&repeatCount=1") | ||
.routeId("Failure Route") | ||
.transacted() | ||
.log(">>> Generating New Person") | ||
.setBody(constant(new Person(2, "Rolled_Back_" + Person.generateName()))) | ||
.log(">>> Saving Person") | ||
.to("jpa://org.redhat.consulting.fusequickstarts.karaf.jpa.model.Person") | ||
.log(">>> Saved Person: ${body}!") | ||
.beanRef("dummy","crash") | ||
.log(">>> Rolled back");*/ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
karaf/jpa_jta/src/main/resources/OSGI-INF/blueprint/blueprint.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" | ||
xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0" | ||
xmlns:camel="http://camel.apache.org/schema/blueprint" | ||
xsi:schemaLocation=" | ||
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> | ||
|
||
<reference id="transactionManager" | ||
interface="org.springframework.transaction.PlatformTransactionManager" /> | ||
<reference id="entityManagerFactory" interface="javax.persistence.EntityManagerFactory" /> | ||
|
||
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent"> | ||
<jpa:unit unitname="camelJpaContainer" property="entityManagerFactory" /> | ||
<property name="transactionManager" ref="transactionManager" /> | ||
</bean> | ||
|
||
<bean id="PROPAGATION_REQUIRED" class="org.apache.camel.spring.spi.SpringTransactionPolicy"> | ||
<property name="transactionManager" ref="transactionManager" /> | ||
</bean> | ||
|
||
<bean id="dummy" class="org.redhat.consulting.fusequickstarts.karaf.jpa.Dummy" /> | ||
|
||
<camel:camelContext id="camel" | ||
xmlns="http://camel.apache.org/schema/blueprint"> | ||
<packageScan> | ||
<package>org.redhat.consulting.fusequickstarts.karaf.jpa.route</package> | ||
</packageScan> | ||
</camel:camelContext> | ||
</blueprint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters