Skip to content

Commit 1a70a13

Browse files
committed
Merge branch 'feature/add-spring-batch-example' into develop
2 parents a5f1451 + f28f877 commit 1a70a13

File tree

31 files changed

+818
-88
lines changed

31 files changed

+818
-88
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ assetInstallTime.properties
1919
/quick-start/plugins
2020
flow.properties
2121
node_modules/
22+
.tmp/

examples/spring-batch/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
.gradle
3+
.tmp

examples/spring-batch/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Spring Batch Job using the Data Hub
2+
3+
This example demonstrates how to run a custom Spring Batch job against the Data Hub Framework.
4+
5+
This is based on the [base job from MarkLogic Spring batch](https://github.com/sastafford/marklogic-spring-batch/tree/master/examples/base). The base job is intended to be a starter template for writing any MarkLogic Spring Batch job. Just copy and paste this directory into your workspace and modify the classes to your specific batch processing use case.
6+
7+
This is an example where the Data Hub Project artifacts have already been initialized. If you are wanting to add this ability to existing Data Hub Projects then you simply need to modify the build.gradle file.
8+
9+
```gradle
10+
plugins {
11+
// existing ids...
12+
...
13+
14+
// add application
15+
id 'application'
16+
}
17+
18+
dependencies {
19+
// existing dependencies
20+
21+
// add this one:
22+
compile "com.marklogic:marklogic-spring-batch-core:0.6.0"
23+
}
24+
25+
26+
// add the distributions section
27+
distributions {
28+
main {
29+
baseName = 'baseJob'
30+
}
31+
}
32+
33+
// add the mainClassName to specify the HubJobRunner
34+
mainClassName = "com.marklogic.spring.batch.hub.HubJobRunner"
35+
36+
```
37+
38+
# How to Run
39+
40+
gradle installDist
41+
42+
./run.sh
43+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<monster>
3+
<name>BigBird</name>
4+
<color>yellow</color>
5+
</monster>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<monster>
3+
<name>Elmo</name>
4+
<color>red</color>
5+
</monster>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<monster>
3+
<name>Grover</name>
4+
<color>blue</color>
5+
</monster>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"database-name": "%%mlFinalDbName%%",
3+
"range-element-index": [
4+
{
5+
"scalar-type": "dateTime",
6+
"namespace-uri": "http://marklogic.com/xdmp/dls",
7+
"localname": "created",
8+
"collation": "",
9+
"range-value-positions": false,
10+
"invalid-values": "reject"
11+
},
12+
{
13+
"scalar-type": "dateTime",
14+
"namespace-uri": "http://marklogic.com/xdmp/dls",
15+
"localname": "replaced",
16+
"collation": "",
17+
"range-value-positions": false,
18+
"invalid-values": "reject"
19+
},
20+
{
21+
"scalar-type": "unsignedLong",
22+
"namespace-uri": "http://marklogic.com/xdmp/dls",
23+
"localname": "version-id",
24+
"collation": "",
25+
"range-value-positions": false,
26+
"invalid-values": "reject"
27+
},
28+
{
29+
"scalar-type": "unsignedInt",
30+
"namespace-uri": "http://marklogic.com/data-hub/debug",
31+
"localname": "is-debugging-enabled",
32+
"collation": "",
33+
"range-value-positions": false,
34+
"invalid-values": "reject"
35+
}
36+
],
37+
"schema-database": "%%SCHEMAS_DATABASE%%",
38+
"triggers-database": "%%TRIGGERS_DATABASE%%",
39+
"triple-index": true,
40+
"collection-lexicon": true,
41+
"uri-lexicon": true
42+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"database-name": "%%mlJobDbName%%",
3+
"range-element-index": [
4+
{
5+
"scalar-type": "dateTime",
6+
"namespace-uri": "http://marklogic.com/xdmp/dls",
7+
"localname": "created",
8+
"collation": "",
9+
"range-value-positions": false,
10+
"invalid-values": "reject"
11+
},
12+
{
13+
"scalar-type": "dateTime",
14+
"namespace-uri": "http://marklogic.com/xdmp/dls",
15+
"localname": "replaced",
16+
"collation": "",
17+
"range-value-positions": false,
18+
"invalid-values": "reject"
19+
},
20+
{
21+
"scalar-type": "unsignedLong",
22+
"namespace-uri": "http://marklogic.com/xdmp/dls",
23+
"localname": "version-id",
24+
"collation": "",
25+
"range-value-positions": false,
26+
"invalid-values": "reject"
27+
},
28+
{
29+
"scalar-type": "unsignedLong",
30+
"namespace-uri": "http://marklogic.com/spring-batch",
31+
"localname": "id",
32+
"collation": "",
33+
"range-value-positions": false,
34+
"invalid-values": "reject"
35+
36+
},
37+
{
38+
"scalar-type": "string",
39+
"namespace-uri": "http://marklogic.com/spring-batch",
40+
"localname": "jobName",
41+
"collation": "http://marklogic.com/collation/",
42+
"range-value-positions": false,
43+
"invalid-values": "reject"
44+
},
45+
{
46+
"scalar-type": "dateTime",
47+
"namespace-uri": "http://marklogic.com/spring-batch",
48+
"localname": "createDateTime",
49+
"collation": "",
50+
"range-value-positions": false,
51+
"invalid-values": "reject"
52+
}
53+
],
54+
"path-namespace": [
55+
{
56+
"prefix": "msb",
57+
"namespace-uri": "http://marklogic.com/spring-batch"
58+
}
59+
],
60+
"range-path-index": [
61+
{
62+
"scalar-type": "unsignedLong",
63+
"collation": "",
64+
"path-expression": "/msb:mlJobInstance/msb:jobExecutions/msb:jobExecution/msb:id",
65+
"range-value-positions": false,
66+
"invalid-values": "reject"
67+
}
68+
],
69+
"schema-database": "%%SCHEMAS_DATABASE%%",
70+
"triggers-database": "%%TRIGGERS_DATABASE%%",
71+
"triple-index": true,
72+
"collection-lexicon": true,
73+
"uri-lexicon": true,
74+
"maintain-last-modified": true
75+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"database-name": "%%mlModulesDbName%%",
3+
"collection-lexicon": true,
4+
"uri-lexicon": true
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"database-name": "%%mlSchemasDbName%%"
3+
}

0 commit comments

Comments
 (0)