A Spring Boot application demonstrating advanced Temporal workflow patterns, extending the Temporal Java Getting Started Guide with a ledger implementation that showcases long-running workflows (actor pattern) and Temporal's "continue as new" feature.
- Java 21 or later
- Temporal Server running locally
# Build the application
./gradlew build
# Run unit tests
./gradlew test
# Start the application
./gradlew bootRun
# Or run the jar directly
java -jar build/libs/temporal-example-1.0.0.jar| Endpoint | Method | Description |
|---|---|---|
/v1/service/transfer |
GET | Initiate a money transfer |
/v1/service/history |
GET | View transaction history |
- Initial transfer: http://localhost:8080/v1/service/transfer
- Transaction history: http://localhost:8080/v1/service/history
# Run all tests
./gradlew test
# Run CI build (includes tests, coverage, and security checks)
./gradlew ciBuild# Run static analysis tools (no security scan)
./gradlew pmdMain checkstyleMain
# Run individual analysis tools
./gradlew pmdMain # Code style analysis
./gradlew checkstyleMain # Style complianceThis project includes comprehensive GitHub Actions workflows:
- Build and Test (
build.yml): Tests on Java 21, builds artifacts with Java 21 - Static Analysis (
static-analysis.yml): PMD and Checkstyle code quality analysis with Java 21 - Dependency Updates (
dependabot.yml): Automated dependency updates
- Temporal Web UI: http://localhost:8233/namespaces/default/workflows
- Application: http://localhost:8080
This application extends the Temporal Java Getting Started Guide by adding:
- Ledger Workflow: A long-running workflow using the actor pattern that maintains transaction history
- Continue As New: Demonstrates proper implementation of Temporal's continue-as-new feature to handle unlimited workflow execution
- Unit Testing: Comprehensive tests for long-running workflows and continue-as-new scenarios using advanced testing techniques
- Continue-as-New Testing: Verifies workflow history events to ensure continue-as-new is triggered correctly
- Workflow History Inspection: Tests examine
WorkflowExecutionContinuedAsNewEventAttributesin execution history - State Persistence Testing: Validates that workflow state is properly maintained across continue-as-new boundaries
- Money Transfer Pattern: Distributed transaction implementation with compensation
- Activity Implementation: External service calls with retry policies
- Actor Pattern: The ledger workflow acts as a stateful actor that processes events over time
- Continue As New: Prevents workflow history from growing too large by resetting execution state
- Event Sourcing: Transaction history is maintained within the workflow state
- Comprehensive Testing: Unit tests that verify continue-as-new behavior and workflow state management
- Event History Verification: Tests inspect workflow execution history for continue-as-new events
- State Boundary Testing: Validates data persistence across workflow restarts
- Long-Running Workflow Patterns: Demonstrates testing strategies for workflows that may run indefinitely
- Development Guide: Detailed setup and development workflow
- Workflow Documentation: CI/CD pipeline details
src/main/java/com/claymccoy/meteor/shower/
├── Service.java # Spring Boot main application
├── ServiceResource.java # REST API endpoints
├── ServiceConfig.java # Application configuration
├── moneytransfer/
│ ├── AccountActivity.java # Temporal activity interface
│ ├── AccountActivityImpl.java # Activity implementation
│ ├── LedgerService.java # Business service layer
│ ├── LedgerWorkflow*.java # Ledger workflow definitions
│ ├── MoneyTransferWorkflow*.java # Transfer workflow definitions
│ └── MoneyTransferWorker.java # Temporal worker setup
└── temporal/
└── TemporalConfig.java # Temporal client configuration