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

Use new APIs added in v4.1.0 to simplify remote chunking configuration #2

Closed
wants to merge 1 commit into from
Closed

Conversation

fmbenhassine
Copy link

@fmbenhassine fmbenhassine commented Apr 18, 2018

Hi Michael,

This PR shows how to use the new builders to simplify remote chunking setup.
It uses the 4.1.0.BUILD-SNAPSHOT version that you need to build and install locally after applying the changes of this PR.

This PR is not meant to be merged. I just submit it as a showcase and as a support for our discussion.

Kr,
Mahmoud

@fmbenhassine
Copy link
Author

fmbenhassine commented Apr 24, 2018

Hi Michael,

I updated both pull requests as discussed. It now works with channels instead of channel names. The remote chunking sample is working fine with these changes. I'll let you give it a try.

You will notice that we still need to autowire the job repository and transaction manager in the master step. We would not want to do that to be consistent with JobBuilderFactory and StepBuilderFactory. So as discussed, I created a factory for the builder, but now the question is how to inject this new factory in our configuration class?

  • This cannot be done like JobBuilderFactory and StepBuilderFactory in the core module since this factory is in the integration module. Of course adding a dependency to the integration module (even optional) is not an option. It will not even work since we'll have a circular dependency.
  • Adding @Component on the factory and autowire dependencies might work but the bean still need to be declared in order to inject it in our configuration class
  • I tried to use @Configurable on the factory and autowire the job repository and transaction manager but this option requires aspectj weaving right? Please correct me if I'm wrong.
  • I though of some kind of configuration class, let's say RemoteChunkingConfiguration that declares a bean of type RemoteChunkingMasterStepBuilderFactory with its dependency being autowired. But this option still require to import this class in our configuration class with @Import(RemoteChunkingConfiguration.class) to be able to use the factory.
  • Another option is to create a factory bean that creates the factory.. But I don't like this "inception" option 😃

I would love to hear your thoughts on this.

Day after day, I'm amazed how a user story of adding a builder - which looks easy at first glance - can hide a lot of challenges!

Best regards,
Mahmoud

@fmbenhassine
Copy link
Author

fmbenhassine commented Apr 27, 2018

Hello Michael,

I updated both pull requests by adding the new EnableBatchIntegration annotation as discussed. Thanks to this annotation, we can now autowire the RemoteChunkingMasterStepBuilderFactory in the master step configuration and specify only what is needed (reader, inputChannel and outputChannel). The job repository and the transaction manager are set automatically.

Same thing on the worker side, we can autowire the RemoteChunkingWorkerBuilder and create the integration flow without having to know about the ChunkProcessorChunkHandler and ServiceActivator.

Kr,
Mahmoud

@fmbenhassine fmbenhassine changed the title simplify remote chunking configuration Use new APIs added in v4.1.0 to simplify remote chunking configuration Sep 3, 2018
@fmbenhassine
Copy link
Author

This PR has been updated to v4.1.0.M2 and is now ready to merge.

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

Successfully merging this pull request may close these issues.

None yet

1 participant