Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use other version than 0.1.0. I failed to integrate this in my current project #153

Closed
kev205 opened this issue Nov 8, 2024 · 14 comments

Comments

@kev205
Copy link

kev205 commented Nov 8, 2024

No description provided.

@scordio
Copy link
Collaborator

scordio commented Nov 8, 2024

Hi @kev205, which module are you trying to integrate?

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

Hello @scordio thanks,
I want to build batch job for my neo4j data so it is spring-batch-neo4j

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

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

@scordio
Copy link
Collaborator

scordio commented Nov 8, 2024

That's correct, version 0.1.0 is the latest version published.

Are you facing any issues with this version?

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

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

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

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.

@scordio
Copy link
Collaborator

scordio commented Nov 8, 2024

Hi @michael-simons, would you have any hints?

@michael-simons
Copy link
Collaborator

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

41cbb93

by my colleague @meistermeier has been released.

Hope that helps a bit.

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

Hello @michael-simons how to get that change?

1 similar comment
@kev205
Copy link
Author

kev205 commented Nov 8, 2024

Hello @michael-simons how to get that change?

@michael-simons
Copy link
Collaborator

I have no rights or means to release on that repository, sorry.

@kev205
Copy link
Author

kev205 commented Nov 8, 2024

So any advise for me? Or i just have to skip the batch feature on my project?

@scordio
Copy link
Collaborator

scordio commented Nov 8, 2024

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?

@scordio scordio added this to the Spring Batch Neo4j 1.0.0 milestone Nov 8, 2024
@scordio
Copy link
Collaborator

scordio commented Nov 8, 2024

Closing in favor of #157.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants