Skip to content

Commit cb46488

Browse files
committed
Examples working as Karaf features
1 parent ca45848 commit cb46488

File tree

30 files changed

+521
-402
lines changed

30 files changed

+521
-402
lines changed

README.md

+124-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<!--
22
3-
Copyright 2005-2015 Red Hat, Inc.
3+
Copyright 2005-2015 Red Hat, Inc.
44
5-
Red Hat licenses this file to you under the Apache License, version
6-
2.0 (the "License"); you may not use this file except in compliance
7-
with the License. You may obtain a copy of the License at
5+
Red Hat licenses this file to you under the Apache License, version
6+
2.0 (the "License"); you may not use this file except in compliance
7+
with the License. You may obtain a copy of the License at
88
9-
http://www.apache.org/licenses/LICENSE-2.0
9+
http://www.apache.org/licenses/LICENSE-2.0
1010
11-
Unless required by applicable law or agreed to in writing, software
12-
distributed under the License is distributed on an "AS IS" BASIS,
13-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14-
implied. See the License for the specific language governing
15-
permissions and limitations under the License.
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14+
implied. See the License for the specific language governing
15+
permissions and limitations under the License.
1616
1717
-->
1818
# Description
@@ -329,6 +329,31 @@ consult the solution [on IBM website](http://www-01.ibm.com/support/docview.wss?
329329

330330
# JBoss Fuse installation and configuration
331331

332+
1. Unzip the `jboss-fuse-full-6.2.0.redhat-060.zip` archive distribution. The target directory `jboss-fuse-6.2.0.redhat-060` will
333+
be referred to as `$JBOSS_FUSE_HOME`.
334+
2. Add the following credentials to `$JBOSS_FUSE_HOME/etc/users.properties`:
335+
336+
admin=admin,admin,manager,viewer,Operator,Maintainer,Deployer,Auditor,Administrator,SuperUser
337+
338+
3. Start JBoss Fuse:
339+
340+
$JBOSS_FUSE_HOME/bin/fuse
341+
342+
4. Make sure only one `transaction` bundle is installed:
343+
344+
JBossFuse:karaf@root> osgi:list -t 0 -s | grep transaction
345+
[ 163] [Active ] [ ] [ ] [ 30] org.apache.aries.transaction.manager (1.1.0)
346+
[ 164] [Active ] [Created ] [ ] [ 30] org.apache.aries.transaction.blueprint (1.0.1)
347+
[ 190] [Active ] [ ] [ ] [ 50] org.apache.aries.transaction.manager (1.0.0)
348+
349+
If the above is the case, please uninstall all versions except `1.1.0`:
350+
351+
JBossFuse:karaf@root> osgi:uninstall 190
352+
You are about to access system bundle 190. Do you wish to continue (yes/no): yes
353+
354+
(This problem should be fixed in the next version of JBoss Fuse 6.2)
355+
356+
332357
# Examples
333358

334359
## Camel route with 2 transaction managers
@@ -341,6 +366,78 @@ This example is comprised of the following projects:
341366

342367
Ensure you have installed and configured a database server of choice (currently: PostgreSQL)
343368

369+
1. `cd $PROJECT_HOME`
370+
2. `mvn clean install -Ppostgresql` (or other DB, like `mariadb`, `h2`, `derby`, `db2`, `oracle`)
371+
3. install features repository:
372+
373+
features:addurl mvn:org.jboss.fuse.examples.camel-persistence-part2/features/6.2/xml/features
374+
375+
4. install `reportincident-jpa-two` feature:
376+
377+
features:install -v reportincident-jpa-two
378+
379+
5. make sure relevant bundles are installed:
380+
381+
JBossFuse:karaf@root> list | grep Examples
382+
[ 309] [Active ] [Created ] [ ] [ 80] JBoss Fuse :: Examples :: Fuse ESB & Persistence :: Datasource (6.2.0)
383+
[ 310] [Active ] [Created ] [ ] [ 80] JBoss Fuse :: Examples :: Fuse ESB & Persistence :: DAO (6.2.0)
384+
[ 311] [Active ] [Created ] [ ] [ 80] JBoss Fuse :: Examples :: Fuse ESB & Persistence :: Camel - 2 Tx Managers (6.2.0)
385+
386+
6. Start PostgreSQL client and observe `REPORT.T_INCIDENT` table:
387+
388+
$ docker exec -ti fuse-postgresql-server /bin/bash
389+
root@b052efff5a53:/# psql -d reportdb -U fuse
390+
psql (9.4.0)
391+
Type "help" for help.
392+
393+
reportdb=# select * from report.t_incident order by incident_id asc;
394+
incident_id | incident_ref | incident_date | given_name | family_name | summary | details | email | phone | creation_date | creation_user
395+
-------------+--------------+---------------------+------------+-------------+----------------------+-------------------------------------------+---------------------------+----------------+-------------------------+---------------
396+
1 | 001 | 2015-01-23 00:00:00 | Charles | Moulliard | incident webinar-001 | This is a report incident for webinar-001 | [email protected] | +111 10 20 300 | |
397+
2 | 002 | 2015-01-24 00:00:00 | Charles | Moulliard | incident webinar-002 | This is a report incident for webinar-002 | [email protected] | +111 10 20 300 | |
398+
3 | 003 | 2015-01-25 00:00:00 | Charles | Moulliard | incident webinar-003 | This is a report incident for webinar-003 | [email protected] | +111 10 20 300 | |
399+
4 | 004 | 2015-01-26 00:00:00 | Charles | Moulliard | incident webinar-004 | This is a report incident for webinar-004 | [email protected] | +111 10 20 300 | |
400+
(5 rows)
401+
402+
reportdb=#
403+
404+
7. Launch JConsole (inside $JAVA_HOME/bin) and connect using the following information:
405+
406+
* Remote process: `service:jmx:rmi://localhost:44444/jndi/rmi://localhost:1099/karaf-root`
407+
* Username: `admin`
408+
* Password: `admin`
409+
410+
8. Switch to the MBeans tab at the top. On the left pane, expand the `org.apache.activemq` domain, then
411+
navigate to: Broker > amq > Queue. You will see the `incident` and `rollback` queues. The `registerCall`
412+
queue will appear when it is first used. For these queues, you will be interested in tracking the
413+
`EnqueueCount` attribute.
414+
415+
9. Copy the following files to `$JBOSS_FUSE_HOME/datainsert` and notice the effect in the `registerCall` queue and the `REPORT.T_INCIDENT` table:
416+
417+
* `$PROJECT_HOME/data/csv-one-record-allok.txt`:
418+
* `REPORT.T_INCIDENT` table: new record
419+
* `incident` queue: new message enqueued
420+
* `rollback` queue: no new messages
421+
* `registerCall` queue: new message enqueued
422+
423+
* `$PROJECT_HOME/data/csv-one-record-failjms-dbok.txt`:
424+
* `REPORT.T_INCIDENT` table: new record
425+
* `incident` queue: new message enqueued
426+
* `rollback` queue: no new messages
427+
* `registerCall` queue: no new messages
428+
429+
* `$PROJECT_HOME/data/csv-one-record-jmsok-faildb.txt`:
430+
* `REPORT.T_INCIDENT` table: no record inserted
431+
* `incident` queue: no new messages
432+
* `rollback` queue: new message enqueued
433+
* `registerCall` queue: new message enqueued
434+
435+
* `$PROJECT_HOME/data/csv-one-record-failjms-faildb.txt`:
436+
* `REPORT.T_INCIDENT` table: no record inserted
437+
* `incident` queue: no new messages
438+
* `rollback` queue: new message enqueued
439+
* `registerCall` queue: no new messages
440+
344441
## Camel route with 1 global transaction manager
345442

346443
This example is comprised of the following projects:
@@ -353,11 +450,20 @@ Ensure you have installed and configured a database server of choice (currently:
353450

354451
To install and test, assuming that you have previously run the "Camel Route with 2 Tx Managers" example above:
355452

356-
1. First uninstall the reportincident-jpa-two feature (TODO)
453+
1. First uninstall the `reportincident-jpa-two` feature:
454+
455+
features:uninstall reportincident-jpa-two
456+
457+
2. Install the reportincident-jpa-one feature:
458+
459+
features:install -v reportincident-jpa-one
357460

358-
2. Install the reportincident-jpa-one feature (TODO)
461+
3. make sure relevant bundles are installed:
359462

360-
3. Execute the "list" command in the ESB shell and check that the following bundles are Active (TODO)
463+
JBossFuse:karaf@root> list | grep Examples
464+
[ 314] [Active ] [Created ] [ ] [ 80] FuseSource :: Examples :: Fuse ESB & Persistence :: Datasource (6.2.0)
465+
[ 315] [Active ] [Created ] [ ] [ 80] FuseSource :: Examples :: Fuse ESB & Persistence :: DAO - JTA (6.2.0)
466+
[ 316] [Active ] [Created ] [ ] [ 80] FuseSource :: Examples :: Fuse ESB & Persistence :: Camel - 1 Tx Manager (6.2.0)
361467

362468
4. Copy the following files to `$JBOSS_FUSE_HOME/datainsert` and notice the new behaviour in the second and third cases, in terms of the registerCall queue and the REPORT.T_INCIDENT table:
363469

@@ -368,19 +474,19 @@ To install and test, assuming that you have previously run the "Camel Route with
368474
* `registerCall` queue: new message enqueued
369475

370476
* `$PROJECT_HOME/data/csv-one-record-failjms-dbok.txt`:
371-
* `REPORT.T_INCIDENT` table: new record
477+
* `REPORT.T_INCIDENT` table: no record inserted
372478
* `incident` queue: new message enqueued
373479
* `rollback` queue: no new messages
374480
* `registerCall` queue: no new messages
375481

376-
* `$PROJECT_HOME/data/csv-one-record-failjms-faildb.txt`:
377-
* `REPORT.T_INCIDENT` table: new record
482+
* `$PROJECT_HOME/data/csv-one-record-jmsok-faildb.txt`:
483+
* `REPORT.T_INCIDENT` table: no record inserted
378484
* `incident` queue: no new messages
379485
* `rollback` queue: new message enqueued
380486
* `registerCall` queue: no new messages
381487

382-
* `$PROJECT_HOME/data/csv-one-record-jmsok-faildb.txt`:
383-
* `REPORT.T_INCIDENT` table: new record
488+
* `$PROJECT_HOME/data/csv-one-record-failjms-faildb.txt`:
489+
* `REPORT.T_INCIDENT` table: no record inserted
384490
* `incident` queue: no new messages
385491
* `rollback` queue: new message enqueued
386492
* `registerCall` queue: no new messages

aggregator/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<groupId>com.fusesource.examples.camel-persistence-part2</groupId>
3030
<artifactId>aggregator</artifactId>
31-
<name>FuseSource :: Examples :: Fuse ESB &amp; Persistence :: Camel - Aggregator</name>
31+
<name>JBoss Fuse :: Examples :: Fuse ESB &amp; Persistence :: Camel - Aggregator</name>
3232

3333
<dependencies>
3434
<dependency>

dao-jta/pom.xml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2005-2015 Red Hat, Inc.
4+
Copyright 2005-2015 Red Hat, Inc.
55
6-
Red Hat licenses this file to you under the Apache License, version
7-
2.0 (the "License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
6+
Red Hat licenses this file to you under the Apache License, version
7+
2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15-
implied. See the License for the specific language governing
16-
permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
implied. See the License for the specific language governing
16+
permissions and limitations under the License.
1717
1818
-->
1919
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -31,7 +31,7 @@
3131
<artifactId>dao-jta</artifactId>
3232
<packaging>bundle</packaging>
3333

34-
<name>FuseSource :: Examples :: Fuse ESB &amp; Persistence :: DAO - JTA</name>
34+
<name>JBoss Fuse :: Examples :: Fuse ESB &amp; Persistence :: DAO - JTA</name>
3535

3636
<properties>
3737
<database />

dao-jta/src/main/resources-filtered/postgresql/META-INF/persistence.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2005-2015 Red Hat, Inc.
4+
Copyright 2005-2015 Red Hat, Inc.
55
6-
Red Hat licenses this file to you under the Apache License, version
7-
2.0 (the "License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
6+
Red Hat licenses this file to you under the Apache License, version
7+
2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15-
implied. See the License for the specific language governing
16-
permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
implied. See the License for the specific language governing
16+
permissions and limitations under the License.
1717
1818
-->
1919
<persistence xmlns="http://java.sun.com/xml/ns/persistence"

dao-jta/src/main/resources/OSGI-INF/blueprint/dao-jta.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2005-2015 Red Hat, Inc.
4+
Copyright 2005-2015 Red Hat, Inc.
55
6-
Red Hat licenses this file to you under the Apache License, version
7-
2.0 (the "License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
6+
Red Hat licenses this file to you under the Apache License, version
7+
2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15-
implied. See the License for the specific language governing
16-
permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
implied. See the License for the specific language governing
16+
permissions and limitations under the License.
1717
1818
-->
1919
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"

dao/pom.xml

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2005-2015 Red Hat, Inc.
4+
Copyright 2005-2015 Red Hat, Inc.
55
6-
Red Hat licenses this file to you under the Apache License, version
7-
2.0 (the "License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
6+
Red Hat licenses this file to you under the Apache License, version
7+
2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15-
implied. See the License for the specific language governing
16-
permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
implied. See the License for the specific language governing
16+
permissions and limitations under the License.
1717
1818
-->
1919
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -31,14 +31,13 @@
3131
<artifactId>dao</artifactId>
3232
<packaging>bundle</packaging>
3333

34-
<name>FuseSource :: Examples :: Fuse ESB &amp; Persistence :: DAO</name>
34+
<name>JBoss Fuse :: Examples :: Fuse ESB &amp; Persistence :: DAO</name>
3535

3636
<properties>
3737
<database />
3838
<persistence-file>META-INF/persistence.xml</persistence-file>
3939
<osgi-import-pkg>
40-
*,
41-
org.apache.openjpa.util
40+
*
4241
</osgi-import-pkg>
4342
<osgi-export-pkg>
4443
org.jboss.fuse.examples.persistence.part2.model,

dao/src/main/resources-filtered/postgresql/META-INF/persistence.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2005-2015 Red Hat, Inc.
4+
Copyright 2005-2015 Red Hat, Inc.
55
6-
Red Hat licenses this file to you under the Apache License, version
7-
2.0 (the "License"); you may not use this file except in compliance
8-
with the License. You may obtain a copy of the License at
6+
Red Hat licenses this file to you under the Apache License, version
7+
2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
99
10-
http://www.apache.org/licenses/LICENSE-2.0
10+
http://www.apache.org/licenses/LICENSE-2.0
1111
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15-
implied. See the License for the specific language governing
16-
permissions and limitations under the License.
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15+
implied. See the License for the specific language governing
16+
permissions and limitations under the License.
1717
1818
-->
1919
<persistence xmlns="http://java.sun.com/xml/ns/persistence"

0 commit comments

Comments
 (0)