Annotation Interface TrackSelf
When this annotation is present on a class (or its interface), Fluxzero will automatically register a handler for any implementation of that type. The resulting handler behaves like a standard external consumer: the message is first published to the appropriate message log and then tracked and processed via the configured consumer infrastructure.
Without this annotation, a payload class with handler methods (e.g., HandleCommand) would be treated as a
local handler. That means it would be executed immediately, bypassing the message log and any tracking.
You may also annotate the class with Consumer to configure message consumption in an isolated consumer.
If no @Consumer annotation is present, the handler will be assigned to the application's default consumer.
Spring integration: When using Spring, types annotated with @TrackSelf will be
detected and registered as handlers when they fall within the application's component-scan scope. They are not
exposed as regular injectable Spring beans. Concrete implementations of an annotated interface are detected within
the same scan scope, even when handler methods are declared only by those implementations. Type-level conditional
annotations are still respected, including
ConditionalOnProperty and
ConditionalOnMissingProperty. When not using Spring, you must register
the class manually. The asynchronous TestFixture can discover self-tracking payloads as messages are
dispatched during a test.
When multiple types in the same hierarchy specialize self-tracking, the most specific applicable type handles the
payload. This prevents duplicate handling when both an interface or abstract base class and a concrete class declare
@TrackSelf. A Consumer declared on that more specific type takes precedence over one inherited from
an interface or base class.
- See Also: