@Ignore annotation marks workflow properties that should not be serialized and stored as part of the workflow state.
Package
Targets
- Fields (class properties)
- Properties (class properties)
Overview
Use@Ignore for workflow properties that:
- Are stateless or can be recreated
- Hold references to external services or clients
- Contain non-serializable objects
- Should not be persisted between workflow method executions
Usage
Basic Example
Common Use Cases
Loggers
Metrics Collectors
Cached Service Stubs
Thread-Local or Contextual Data
Computed Properties
Lazy Initialization Pattern
For ignored properties that are expensive to create, use lazy initialization:What Should NOT Be Ignored
Do not use@Ignore on:
Workflow State
Business Data
Deferred Results You Need Later
Best Practices
- Use @Ignore liberally for infrastructure: Loggers, metrics, clients
- Never ignore business state: Any data needed for workflow logic
- Test serialization: Ensure workflows can be serialized/deserialized
- Initialize ignored fields safely: Use lateinit or lazy with null checks
- Document ignored fields: Explain why they’re ignored
- Keep workflows lightweight: Minimize the amount of state to serialize
Serialization Example
Testing
Test that ignored properties don’t break workflow execution:See Also
- Workflow - For workflow implementation
- Name Annotation - For custom naming