|
4 | 4 |
|
5 | 5 | # Purpose |
6 | 6 |
|
7 | | -By default, Spring Batch provides Neo4jItemReader and Neo4jItemWriter, but it lacks out-of-the-box adapter |
8 | | -to persist its metadata in Neo4j. This project offers ready to use Spring Batch metadata persistence adapter |
9 | | -for the Neo4j database. It allows Spring Batch to store its metadata directly in Neo4j so that no RDBMS/SQL database |
10 | | -is needed. |
| 7 | +Currently, the support of NoSQL databases in Spring-Batch is limited ItemReader/ItemWriter for Neo4j and Mongo. |
| 8 | +This means that to persist state of Spring-Batch job you would need to have RDMBS database even if you don't need it. |
| 9 | +See these open tickets: |
| 10 | + |
| 11 | + - https://github.com/spring-projects/spring-batch/issues/877 |
| 12 | + - https://github.com/spring-projects/spring-batch/issues/1988 |
| 13 | + |
| 14 | +This project aims to solve this problem for Neo4. It offers ready to use Spring Batch metadata persistence adapter |
| 15 | +for the Neo4j database. This adapter allows Spring Batch to store its metadata directly in Neo4j so that |
| 16 | +no RDBMS/SQL database is needed. |
11 | 17 |
|
12 | 18 | # Importing it to your project |
13 | 19 |
|
@@ -121,3 +127,39 @@ public class SimpleJobService { |
121 | 127 | } |
122 | 128 | } |
123 | 129 | ``` |
| 130 | + |
| 131 | +## Used by |
| 132 | + |
| 133 | +You can see how to configure the adapter and how to use it in 'real' project see this link: |
| 134 | + - https://github.com/valb3r/time-tracker/ in particular [worker](https://github.com/valb3r/time-tracker/tree/master/worker) submodule. |
| 135 | + |
| 136 | +## Connection configuration |
| 137 | + |
| 138 | +The adapter will reuse `spring.data.neo4j` database connection properties if you provide them in |
| 139 | +i.e. `application.yml`. |
| 140 | +For example: |
| 141 | + |
| 142 | +``` |
| 143 | +spring: |
| 144 | + # Run neo4j with docker: |
| 145 | + # docker run --rm -d --publish=7474:7474 --publish=7687:7687 --volume=$HOME/neo4j/data:/data -e NEO4J_AUTH=neo4j/docker neo4j/neo4j-experimental:4.0.0-rc01 |
| 146 | + data: |
| 147 | + neo4j: |
| 148 | + uri: bolt://localhost:7687 |
| 149 | + username: neo4j |
| 150 | + password: docker |
| 151 | + open-in-view: false |
| 152 | + use-native-types: true |
| 153 | +``` |
| 154 | + |
| 155 | +All repositories are provided by: |
| 156 | +``` |
| 157 | +@EnableNeo4jRepositories( |
| 158 | + basePackages = { |
| 159 | + "com.github.valb3r.springbatch.adapters.neo4j.ogm.repository" |
| 160 | + } |
| 161 | +) |
| 162 | +``` |
| 163 | + |
| 164 | +This way, all of them are configured using same spring configuration as you have for your own |
| 165 | +Neo4-repositories. |
0 commit comments