From d8660c0437544d2656188934fe724d486651980a Mon Sep 17 00:00:00 2001 From: pgf Date: Sun, 13 Jul 2014 11:44:04 +0200 Subject: [PATCH 1/4] added username and password to resourceManager-AMQ --- routing/src/main/resources/META-INF/spring/routing.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routing/src/main/resources/META-INF/spring/routing.xml b/routing/src/main/resources/META-INF/spring/routing.xml index d6ed3f9..812b5fd 100644 --- a/routing/src/main/resources/META-INF/spring/routing.xml +++ b/routing/src/main/resources/META-INF/spring/routing.xml @@ -88,6 +88,8 @@ + + From 1baa3b3effb32111570f7dbbfb28216d16ded3b3 Mon Sep 17 00:00:00 2001 From: pgf Date: Mon, 14 Jul 2014 15:15:41 +0200 Subject: [PATCH 2/4] changing jdbc datasource from derby to mysql --- datasource/README.md | 25 ++- datasource/pom.xml | 52 ++++-- .../aries/demo/GenericResourceManager.java | 37 ----- .../OSGI-INF/blueprint/datasource.xml | 153 ++++++------------ features/src/main/resources/features.xml | 18 +-- 5 files changed, 99 insertions(+), 186 deletions(-) delete mode 100644 datasource/src/main/java/org/apache/aries/demo/GenericResourceManager.java diff --git a/datasource/README.md b/datasource/README.md index 861ecd2..762ac0f 100644 --- a/datasource/README.md +++ b/datasource/README.md @@ -7,21 +7,16 @@ relational database. We are using Blueprint to define the data source bean and publish it into the OSGi Service Registry. Have a look at `src/main/resources/OSGI-INF/blueprint/datasource.xml` for more details about how this done. -Due to bug http://fusesource.com/issues/browse/ENTESB-633 it is not possible to -have the configured JDBC DataSource getting auto-enlisted into Aries. -Instead a workaround solution is presented in src/main/resources/OSGI-INF/blueprint/datasource.xml ## Checking the OSGi Service Registry After the bundle is started, we can use the Fuse ESB Enterprise console to look at the registered objects in the registry. -First, find the bundle id for the bundle called "Fuse By Example :: Transactions :: Datasource" by using the `osgi:list` command. +First, find the bundle id for the bundle called " ESB :: Demo :: Camel-JMS-JDBC-XA-TX :: DataSource" by using the `osgi:list` command. You can use `grep` to filter the list of bundles and quickly find the right one. FuseESB:karaf@root> osgi:list | grep Transactions - [ 268] [Active ] [Created ] [ ] [ 60] Fuse By Example :: Transactions :: Datasource (1.0.0.SNAPSHOT) - [ 269] [Active ] [ ] [ ] [ 60] Fuse By Example :: Transactions :: Database (1.0.0.SNAPSHOT) - [ 270] [Active ] [ ] [Started] [ 60] Fuse By Example :: Transactions :: Routing (1.0.0.SNAPSHOT) + [ 275] [Active ] [Created ] [ ] [ 60] Fuse By Example :: Transactions :: Datasource (1.0.0.SNAPSHOT) In this example, the bundle id is 268. Using the `osgi:ls` command, we can see that this bundle is publishing 3 services: @@ -33,23 +28,23 @@ This is what the `osgi:ls` output looks like FuseESB:karaf@root> osgi:ls 268 - Fuse By Example :: Transactions :: Datasource (268) provides: + Camel :: Demo :: Camel-JMS-JDBC-XA-TX :: DataSource (268) provides: ------------------------------------------------------------- - datasource.name = Derby + datasource.name = MySQL objectClass = javax.sql.XADataSource osgi.jndi.service.name = jdbc/transactions - osgi.service.blueprint.compname = derby-cf + osgi.service.blueprint.compname = mysql-cf service.id = 414 ---- aries.xa.aware = true - datasource.name = Derby + datasource.name = MySQL objectClass = javax.sql.DataSource osgi.jndi.service.name = jdbc/transactions - osgi.service.blueprint.compname = derby-cf + osgi.service.blueprint.compname = mysql-cf service.id = 415 service.ranking = 1000 ---- objectClass = org.osgi.service.blueprint.container.BlueprintContainer - osgi.blueprint.container.symbolicname = org.fusesource.example.transactions.datasource - osgi.blueprint.container.version = 1.0.0.SNAPSHOT - service.id = 416 \ No newline at end of file + osgi.blueprint.container.symbolicname = org.apache.servicemix.demo.camel-jms-jdbc-xa-tx.datasource + osgi.blueprint.container.version = 1.0.0 + service.id = 416 diff --git a/datasource/pom.xml b/datasource/pom.xml index 2a81516..2a038f0 100644 --- a/datasource/pom.xml +++ b/datasource/pom.xml @@ -18,36 +18,54 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - transactions - org.fusesource.example - 1.0-SNAPSHOT - - 4.0.0 - org.fusesource.example.transactions - datasource - bundle - Fuse By Example :: Transactions :: Datasource + + transactions + org.fusesource.example + 1.0-SNAPSHOT + + + org.fusesource.example.transactions + datasource + bundle + Fuse By Example :: Transactions :: Datasource - - + + org.apache.geronimo.components geronimo-connector - 3.1.1 - + 3.0 + - + + + diff --git a/datasource/src/main/java/org/apache/aries/demo/GenericResourceManager.java b/datasource/src/main/java/org/apache/aries/demo/GenericResourceManager.java deleted file mode 100644 index 87334f6..0000000 --- a/datasource/src/main/java/org/apache/aries/demo/GenericResourceManager.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.aries.demo; - -import javax.resource.spi.ManagedConnectionFactory; -import org.apache.geronimo.connector.outbound.ConnectionManagerContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Generic resource manager wrapper. - * Only needed for working around - * http://fusesource.com/issues/browse/ENTESB-633. - * Simply delegates the call to doRecovery() to the configured - * Geronimo ConnectionManagerContainer. - */ -public class GenericResourceManager { - - Logger logger = LoggerFactory.getLogger(GenericResourceManager.class.getName()); - - private ConnectionManagerContainer connectionManagerContainer; - private ManagedConnectionFactory managedConnectionFactory; - - public synchronized void setConnectionManagerContainer( - ConnectionManagerContainer connectionManagerContainer) { - this.connectionManagerContainer = connectionManagerContainer; - } - - public synchronized void setManagedConnectionFactory( - ManagedConnectionFactory managedConnectionFactory) { - this.managedConnectionFactory = managedConnectionFactory; - } - - - public void doRecovery() { - logger.info("Recovering XA resource " + managedConnectionFactory); - connectionManagerContainer.doRecovery(); - } -} diff --git a/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml b/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml index 8718206..8e3ffeb 100644 --- a/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml +++ b/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml @@ -1,99 +1,31 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - --> diff --git a/features/src/main/resources/features.xml b/features/src/main/resources/features.xml index e93d6e0..c7b18b8 100644 --- a/features/src/main/resources/features.xml +++ b/features/src/main/resources/features.xml @@ -26,17 +26,13 @@ camel-jpa camel-jms - - mvn:javax.validation/validation-api/1.1.0.Final - mvn:org.apache.geronimo.components/geronimo-connector/3.1.1 - wrap:mvn:org.tranql/tranql-connector/1.7 - wrap:mvn:org.tranql/tranql-connector-derby-common/1.4 - - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.derby/10.9.1.0_1 + + mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/1.0.1.redhat-610379 + mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0 + + + wrap:mvn:mysql/mysql-connector-java/5.1.26 + mvn:org.fusesource.example.transactions/datasource/${project.version} mvn:org.fusesource.example.transactions/database/${project.version} mvn:org.fusesource.example.transactions/routing/${project.version} From d55ca5c9bdf79c38866d68cb6f3a32e3cf4f1de9 Mon Sep 17 00:00:00 2001 From: pgf Date: Thu, 31 Jul 2014 20:53:08 +0200 Subject: [PATCH 3/4] needed these changes to deploy using fabric --- .../resources/OSGI-INF/blueprint/datasource.xml | 4 ++-- features/src/main/resources/features.xml | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml b/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml index 8e3ffeb..f19554c 100644 --- a/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml +++ b/datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml @@ -16,9 +16,9 @@ - + - + - + mvn:org.apache.karaf.assemblies.features/enterprise/2.3.0.redhat-610379/xml/features + mvn:org.apache.camel.karaf/apache-camel/2.12.0.redhat-610379/xml/features + mvn:io.fabric8/fabric8-karaf/1.0.0.redhat-379/xml/features + + + jpa jndi + transaction camel-blueprint camel-jpa + mq-fabric-camel camel-jms mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/1.0.1.redhat-610379 mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.5_spec/2.0.0 + mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.serp/1.14.1_1 + wrap:mvn:mysql/mysql-connector-java/5.1.26 From a4b6925d5d64d1b823c5db48d6279589dc3d35b1 Mon Sep 17 00:00:00 2001 From: pgf Date: Fri, 8 Aug 2014 09:52:30 +0200 Subject: [PATCH 4/4] to influcence order of bundle startup in fabric - added explicit export and import of OSGi services in database and routing bundle. --- .../database/DatabaseBundleMarker.java | 7 +++++ .../database/DatabaseBundleMarkerImpl.java | 7 +++++ .../OSGI-INF/blueprint/datasource.xml | 28 +++++++++++++++++++ .../resources/META-INF/spring/routing.xml | 3 ++ 4 files changed, 45 insertions(+) create mode 100644 database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarker.java create mode 100644 database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarkerImpl.java create mode 100644 database/src/main/resources/OSGI-INF/blueprint/datasource.xml diff --git a/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarker.java b/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarker.java new file mode 100644 index 0000000..dc9143a --- /dev/null +++ b/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarker.java @@ -0,0 +1,7 @@ +package org.fusesource.example.transactions.database; + +/** + * Created by pfox on 06/08/14. + */ +public interface DatabaseBundleMarker { +} diff --git a/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarkerImpl.java b/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarkerImpl.java new file mode 100644 index 0000000..2db28d9 --- /dev/null +++ b/database/src/main/java/org/fusesource/example/transactions/database/DatabaseBundleMarkerImpl.java @@ -0,0 +1,7 @@ +package org.fusesource.example.transactions.database; + +/** + * Created by pfox on 06/08/14. + */ +public class DatabaseBundleMarkerImpl implements DatabaseBundleMarker { +} diff --git a/database/src/main/resources/OSGI-INF/blueprint/datasource.xml b/database/src/main/resources/OSGI-INF/blueprint/datasource.xml new file mode 100644 index 0000000..ad2a5da --- /dev/null +++ b/database/src/main/resources/OSGI-INF/blueprint/datasource.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/routing/src/main/resources/META-INF/spring/routing.xml b/routing/src/main/resources/META-INF/spring/routing.xml index 812b5fd..f0942cb 100644 --- a/routing/src/main/resources/META-INF/spring/routing.xml +++ b/routing/src/main/resources/META-INF/spring/routing.xml @@ -110,4 +110,7 @@ + + + \ No newline at end of file