@Name annotation allows you to specify a custom name for services, workflows, or methods instead of using the default class or method name.
Package
Targets
- Classes (services and workflows)
- Methods (service methods and workflow methods)
Parameters
The custom name to use
Usage
On Classes
Define a custom name for a service or workflow:On Methods
Define a custom name for a method:Use Cases
Versioning
Use custom names to support multiple versions of a service:Avoiding Conflicts
Prevent naming conflicts when refactoring:Human-Readable Names
Use descriptive names for better monitoring and debugging:Configuration
When using custom names, reference them in your worker configuration:Best Practices
- Use consistent naming conventions: Choose a convention (kebab-case, snake_case, etc.) and stick to it
- Include versions when applicable: Makes it easier to run multiple versions side-by-side
- Keep names stable: Changing names requires migration of running workflows
- Document custom names: Make sure team members know what names map to what implementations
Important Notes
- The name must be unique across all services/workflows in your system
- Changing a name is a breaking change that affects existing workflows
- Worker configuration must use the custom name, not the class name
- Client code references use the interface, not the custom name
Example: Complete Implementation
See Also
- Retry Annotation - For retry policies
- Timeout Annotation - For timeout configuration