Annotations

Complete reference for all Talon annotations available for microservice development.

Overview

Talon provides a comprehensive set of Java annotations for developing microservices. These annotations enable declarative configuration of:

  • Microservice lifecycle hooks

  • Message and event handlers

  • Configuration injection

  • Command handlers

  • Application statistics

  • Store indexes

Annotation Categories

Control microservice lifecycle and dependency injection

Handle inbound messages and events

Inject configuration values

Implement administrative commands

Expose application statistics

Configure state storage and indexing

Expose objects for annotation scanning


Lifecycle Annotations

@AppHAPolicy

Package: com.neeve.server.app.annotations Target: TYPE (class level) Since: 1.0

Specifies the high-availability policy for the microservice.

Parameters:

  • value (required): HAPolicy enum - EventSourcing or StateReplication

Example:

See Also: Consensus Models, Specifying The HA Policy


@AppInjectionPoint

Package: com.neeve.server.app.annotations Target: METHOD, FIELD Since: 1.0

Marks methods or fields for dependency injection by the Talon runtime.

Supported Injectable Types:

  • SrvAppLoader - Application loader

  • AepEngine - AEP engine instance

  • AepEngineDescriptor - Engine configuration descriptor

  • AepMessageSender - Message sender

Examples:

See Also: Lifecycle


@AppInitializer

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Marks the application initialization method, invoked after the engine is created and injected.

Example:

See Also: Lifecycle, Implementing Lifecycle Methods


@AppMain

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Marks the main entry point for synchronous microservices. Invoked in a separate thread after the engine becomes primary.

Example:

See Also: Lifecycle


@AppFinalizer

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Marks the application finalization method, invoked during shutdown before the application is unloaded.

Example:

See Also: Lifecycle


Message Processing Annotations

@EventHandler

Package: com.neeve.aep.annotations Target: METHOD Since: 1.0

Marks methods as handlers for inbound messages or lifecycle events.

Parameters:

  • source (optional, default: "*"): Source filter for events

  • localOnly (optional, default: false): Handle only locally-sourced events (experimental)

Valid Method Signatures:

Example:

See Also: Handling Messages, Lifecycle Events


Configuration Annotations

@Configured

Package: com.neeve.cli.annotations Target: FIELD, METHOD Since: 3.2

Marks fields or methods for configuration injection from XRuntime.

Parameters:

  • property (required): Configuration property name

  • required (optional, default: false): Whether property is required

  • defaultValue (optional, default: ""): Default value if property not set

  • description (optional, default: ""): Property description

Supported Types: boolean, byte, short, int, long, float, double, char, String, XString, enumerations

Examples:

See Also: Injecting Configuration


Command & Control Annotations

@Command

Package: com.neeve.cli.annotations Target: TYPE, METHOD Since: 3.4

Marks a method as an executable command handler for administrative operations.

Parameters:

  • name (optional): Command name (defaults to method name)

  • description (optional): Command description

  • aliases (optional): Alternative command names

  • parseOptions (optional, default: true): Whether to parse options

Example:

See Also: Implementing Command Handlers


@Argument

Package: com.neeve.cli.annotations Target: FIELD, PARAMETER Since: 3.4

Defines a positional command argument.

Parameters:

  • name (required): Argument name

  • position (required): 1-based position

  • description (optional): Argument description

  • defaultValue (optional): Default value

  • required (optional, default: true): Whether argument is required

  • validOptions (optional): Array of valid values

Example:

See Also: Implementing Command Handlers


@Option

Package: com.neeve.cli.annotations Target: FIELD, PARAMETER Since: 3.4

Defines a command option (switch-based parameter).

Parameters:

  • shortForm (required): Short switch character (e.g., 'v')

  • longForm (required): Long switch name (e.g., "verbose")

  • description (optional): Option description

  • defaultValue (optional): Default value

  • required (optional, default: false): Whether option is required

  • validOptions (optional): Array of valid values

Example:

See Also: Implementing Command Handlers


@AppCommandHandler

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Legacy annotation for marking command handlers. @Command is now preferred.

Parameters:

  • command (required): Command name

Example:

See Also: Implementing Command Handlers


Monitoring Annotations

@AppStat

Package: com.neeve.server.app.annotations Target: METHOD, FIELD Since: 1.0

Marks fields or methods that provide statistic values for collection by the engine's statistics collector.

Parameters:

  • gauge (optional, default: true): Whether field/method is a gauge

  • name (optional): Name of the gauge (for gauge stats)

Supported Types:

  • IStats.Counter - Counter statistics

  • IStats.Latencies - Latency statistics

  • IStats.Gauge - Gauge statistics

  • Primitive types (when gauge=true)

Examples:

See Also: Exposing Application Stats


Storage Annotations

@AppStateFactoryAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Provides the state factory for State Replication microservices.

Return Type: IAepApplicationStateFactory

Example:

See Also: State Replication Template


@AppStoreUniqueIndex

Package: com.neeve.server.app.annotations Target: FIELD (type: IStoreUniqueIndex) Since: 2.0

Defines a unique index on state objects for State Replication microservices.

Parameters:

  • name (required): Index name

  • fieldPath (required): Field path on which to create index

Example:


@AppStoreNonUniqueIndex

Package: com.neeve.server.app.annotations Target: FIELD (type: IStoreNonUniqueIndex) Since: 2.0

Defines a non-unique index on state objects for State Replication microservices.

Parameters:

  • name (required): Index name

  • fieldPath (required): Field path on which to create index

Example:


Container Accessor Annotations

These annotations expose objects to the Talon runtime for annotation scanning.

@AppIntrospectionPoints

Package: com.neeve.server.app.annotations Target: METHOD Since: 3.0

Unified accessor that exposes objects for all annotation types. Called multiple times during lifecycle.

Method Signature:

Replaces: All fine-grained *Accessor annotations

See Also: Lifecycle


@AppConfiguredAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 3.2

Exposes objects containing @Configured annotations.

Method Signature:

See Also: Injecting Configuration


@AppCommandHandlerContainersAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 3.4

Exposes objects containing @Command methods.

Method Signature:

See Also: Implementing Command Handlers


@AppEventHandlerContainersAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Exposes objects containing @EventHandler methods.

Method Signature:

See Also: Handling Messages


@AppEventHandlerAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Provides the default event handler (programmatic alternative to @EventHandler).

Return Type: IEventHandler

Method Signature:

See Also: Lifecycle


@AppStatContainersAccessor

Package: com.neeve.server.app.annotations Target: METHOD Since: 1.0

Exposes objects containing @AppStat annotations.

Method Signature:

See Also: Exposing Application Stats


Annotation Packages

Talon annotations are organized into three packages:

com.neeve.aep.annotations

AEP Engine-level annotations:

  • @EventHandler

com.neeve.server.app.annotations

Talon application-level annotations (16 annotations):

  • All @App* annotations

  • Lifecycle, injection, and accessor annotations

com.neeve.cli.annotations

Configuration and command-line interface annotations (4 annotations):

  • @Configured

  • @Command

  • @Argument

  • @Option


Import Examples


Lifecycle Execution Order

Annotations are processed in this order during microservice startup:

  1. @AppInjectionPoint (SrvAppLoader)

  2. @AppHAPolicy

  3. @AppInjectionPoint (AepEngineDescriptor)

  4. @AppConfiguredAccessor / @Configured

  5. @AppCommandHandlerContainersAccessor / @Command

  6. @AppStatContainersAccessor / @AppStat

  7. @AppEventHandlerContainersAccessor / @EventHandler

  8. @AppEventHandlerAccessor

  9. @AppStateFactoryAccessor

  10. @AppInjectionPoint (AepEngine)

  11. @AppInitializer

  12. @AppMain (after becoming primary)

  13. @AppFinalizer (during shutdown)

See Lifecycle for complete flow.


See Also

Last updated