@@ -6,6 +6,8 @@ It covers the different demos made during the talk and is organised like that:
6
6
* ` database ` : directory containing the scripts to create the database for H2, HSQLDB and PostgreSQL RDBMSes
7
7
* ` jdbc-spring ` : Maven project using camel-jdbc component and Spring XML DSL
8
8
* ` jdbc-blueprint ` : Maven project using camel-jdbc component and Blueprint XML DSL
9
+ * ` sql-spring ` : Maven project using camel-sql component and Spring XML DSL
10
+ * ` sql-blueprint ` : Maven project using camel-sql component and Blueprint XML DSL
9
11
10
12
# Initial setup
11
13
@@ -37,25 +39,25 @@ You can use any of available methods to access PostgreSQL server (e.g., by mappi
37
39
38
40
3 . Initialize database ` reportdb ` by creating schema, table and populating the table with data.
39
41
40
- $ cd $PROJECT_HOME/database
41
- $ docker cp src/config/postgresql/reportdb-postgresql-script.sql fuse-postgresql-server:/tmp
42
- $ docker exec -ti fuse-postgresql-server /bin/bash
43
- $ root@58b0d9de9c5b:/# psql -U fuse -d reportdb -f /tmp/reportdb-postgresql-script.sql
44
- ...
45
- DROP SCHEMA
46
- CREATE SCHEMA
47
- CREATE TABLE
48
- INSERT 0 1
49
- INSERT 0 1
50
- INSERT 0 1
51
- INSERT 0 1
42
+ $ cd $PROJECT_HOME/database
43
+ $ docker cp src/config/postgresql/reportdb-postgresql-script.sql fuse-postgresql-server:/tmp
44
+ $ docker exec -ti fuse-postgresql-server /bin/bash
45
+ $ root@58b0d9de9c5b:/# psql -U fuse -d reportdb -f /tmp/reportdb-postgresql-script.sql
46
+ ...
47
+ DROP SCHEMA
48
+ CREATE SCHEMA
49
+ CREATE TABLE
50
+ INSERT 0 1
51
+ INSERT 0 1
52
+ INSERT 0 1
53
+ INSERT 0 1
52
54
53
55
# Running examples
54
56
55
57
## ` jdbc-spring ` and ` jdbc-blueprint `
56
58
57
59
These examples can be run using camel-test-spring and camel-test-blueprint respectively. Examples will run outside
58
- of Fuse server and require only running database server.
60
+ of JBoss Fuse server and require only running database server.
59
61
60
62
For ` jdbc-spring ` example, run:
61
63
@@ -79,9 +81,40 @@ We can also run 2nd Camel context using:
79
81
For ` jdbc-blueprint ` we use Blueprint XML DSL and because of more _ discovery_ nature of ` camel-test-blueprint ` , we
80
82
use only ` camelContext1.xml ` example. We can run this example using:
81
83
82
- $ cd $PROJECT_HOME/jdbc-spring
84
+ $ cd $PROJECT_HOME/jdbc-blueprint
83
85
$ mvn clean package camel:run
84
86
85
87
The invocation is slightly different - ` package ` goal has to be invoked, so we have proper OSGi bundle - or rather
86
88
proper OSGi bundle ` MANIFEST.MF ` file generated in ` target/classes/META-INF ` directory. This allows ` camel-test-blueprint `
87
- to _ pick up_ ` target/classes ` directory as correct OSGi bundle.
89
+ to _ pick up_ ` target/classes ` directory as correct OSGi bundle.
90
+
91
+ ## ` sql-spring ` and ` sql-blueprint `
92
+
93
+ These examples also can be run outside JBoss Fuse server using camel-test-spring and camel-test-blueprint respectively.
94
+ This time we can also create new records in database by sending content of files through Camel route to the database
95
+ using ` camel-spring ` component.
96
+
97
+ For ` sql-spring ` example, run:
98
+
99
+ $ cd $PROJECT_HOME/sql-spring
100
+ $ mvn clean compile camel:run
101
+
102
+ This will start the route and print the content of ` t_incident ` table every 20 seconds. We can create new incidents
103
+ in two ways:
104
+
105
+ 1 . by invoking ` insert-from-file-using-bean ` route that prepares new record in bean method:
106
+
107
+ $ cd $PROJECT_HOME/sql-spring
108
+ $ cp data/key.txt target/datainsert
109
+
110
+ 2 . by invoking ` insert-from-file-using-split ` route that prepares new record simply by splitting comma-separated values
111
+ from given file
112
+
113
+ $ cd $PROJECT_HOME/sql-spring
114
+ $ cp data/keyParams.txt target/datainsertparams
115
+
116
+ For ` sql-blueprint ` the examples are run almost like the ones in ` sql-spring ` , except that ` package ` phase has
117
+ to be invoked.
118
+
119
+ $ cd $PROJECT_HOME/sql-blueprint
120
+ $ mvn clean package camel:run
0 commit comments