Overview
Helix Java application that shows how helix-concurrency fire-and-forget processors handle single events and batches asynchronously.
Run this example from the shared examples build:
Run
Run this example from the shared examples build
./gradlew -p examples runExample -Pexample=library/concurrency-processor --init-script "$(pwd)/helix.init.gradle"
What It Shows
- implementing a custom
FireForgetProcessorfor one-at-a-time async work - implementing a custom
BatchFireForgetProcessorfor grouped async work - submitting events without blocking the caller on processing
- waiting for processor work to drain in tests and demo code
- using the
helix.fireforget.immediate-shutdownsystem property to switch shutdown behavior from graceful to immediate
Example Output
Helix concurrency processor example
fireForget.processed=[invoice-created, invoice-emailed, invoice-archived]
batch.processed=[[audit-1, audit-2], [audit-3]]
shutdown.behavior=GRACEFUL
Development
Building the Application
Run the following command to build the application:
Command
Building the Application
./gradlew clean build
Testing the Application
Run the following command to run the application tests:
Command
Testing the Application
./gradlew test
./gradlew integration
Running the Example
Run the application and inspect how the two processor styles consume work:
Force immediate shutdown behavior instead of graceful draining:
Command
Running the Example
./gradlew run
Command
Running the Example
./gradlew -Dhelix.fireforget.immediate-shutdown=true run