Cannot use other version than 0.1.0. I failed to integrate this in my current project
kev205 opened this issue · 14 comments
Hello @scordio thanks,
I want to build batch job for my neo4j data so it is spring-batch-neo4j
that is my pom.xml:
<dependency>
<groupId>org.springframework.batch.extensions</groupId>
<artifactId>spring-batch-neo4j</artifactId>
<version>0.1.0</version>
</dependency>
The resolver cannot find other version than the 0.1.0
That's correct, version 0.1.0 is the latest version published.
Are you facing any issues with this version?
Yes
My app is a reactive app. This is my neo4j config:
@Configuration
@EnableReactiveNeo4jRepositories(basePackages = "com.orion.xchange.goods.repositories")
@EnableReactiveNeo4jAuditing
public class Neo4jConfig {
@Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
public ReactiveTransactionManager reactiveTransactionManager(Driver driver,
ReactiveDatabaseSelectionProvider databaseNameProvider) {
return new ReactiveNeo4jTransactionManager(driver, databaseNameProvider);
}
@Bean
org.neo4j.cypherdsl.core.renderer.Configuration cypherDslConfiguration() {
return org.neo4j.cypherdsl.core.renderer.Configuration.newConfig()
.withDialect(Dialect.NEO4J_5).build();
}
@Bean
ReactiveAuditorAware<String> reactiveAuditorAware() {
return () -> ReactiveSecurityContextHolder.getContext()
.map(SecurityContext::getAuthentication)
.filter(Authentication::isAuthenticated)
.map(Authentication::getName);
}
@Bean
public Neo4jConversions neo4jConversions() {
Set<GenericConverter> additionalConverters = Set.of(new ImageDTOToValueConverter(),
new Neo4jRatesToUserRateConverter());
return new Neo4jConversions(additionalConverters);
}
}
Now the current version ask me for a sessionFactory but i don't know how to get it. i have tried anything without success
And this is the configuration of spring batch:
@Configuration
@EnableBatchProcessing(tablePrefix = "BATCH_", maxVarCharLength = 1000, isolationLevelForCreate = "SERIALIZABLE")
public class BacthConfig {
@Value("${spring.neo4j.uri}")
private String uri;
@Value("${spring.neo4j.authentication.username}")
private String username;
@Value("${spring.neo4j.authentication.password}")
private String password;
@Bean
public SessionFactory sessionFactory() {
String[] packagesToScan = { "com.orion.xchange.goods.entities" };
org.neo4j.ogm.config.Configuration configuration = new org.neo4j.ogm.config.Configuration.Builder()
.uri(uri)
.credentials(username, password)
.build();
return new SessionFactory(configuration, packagesToScan);
}
@Bean
public ItemReader<ArticleBasics> articleItemReader() {
return new Neo4jItemReaderBuilder<ArticleBasics>()
.name("articleReader")
.sessionFactory(sessionFactory())
.pageSize(50)
.matchStatement("(a:Article)")
.whereStatement("a.status <> 'OUT_OF_STOCK'")
.orderByStatement("a.createdAt DESC")
.returnStatement("a")
.targetType(ArticleBasics.class)
.pageSize(50)
.build();
}
@Bean
public ItemWriter<Article> articleItemWriter() {
return new Neo4jItemWriterBuilder<Article>().sessionFactory(sessionFactory())
.build();
}
}
Am I doing something wrong? I need some help.
Hi @michael-simons, would you have any hints?
Hello.
Warning: I never used Spring Batch in any capacity, so the quality of my answer might not be good.
As far as I know Spring Batch Neo4j used to be build on SDN5 + Neo4j-OGM, at a time at which SDN was only a thin wrapper around Neo4j-OGM the original Neo4j Object mapper. Looking at the version linked above (0.1.0) this is the case in that version.
The configuration @kev205 shared indicates that they are on a recent Spring Boot / Spring Data Neo4j version, which is excellent! SDN6 and higher is an object mapper on its own right, does not use or support Neo4j-OGM.
That however makes it impossible to combine it with this batch extension here, unless a version containing this change
by my colleague @meistermeier has been released.
Hope that helps a bit.
Hello @michael-simons how to get that change?
Hello @michael-simons how to get that change?
I have no rights or means to release on that repository, sorry.
So any advise for me? Or i just have to skip the batch feature on my project?
I think we can organize a release with the help of @fmbenhassine.
I can prepare a milestone and collect the unreleased issues and PRs, so that we can publish a meaningful changelog.
Given the newer combination of dependencies, should we release it as 1.0.0 to signal the major change?