> For the complete documentation index, see [llms.txt](https://docs.xplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xplatform.com/talon/developing-applications/authoring-user-code/lifecycle.md).

# Lifecycle

This section covers how to implement lifecycle methods that control your microservice's initialization and shutdown behavior.

## Overview

Talon microservices have a well-defined lifecycle from initialization through running to shutdown. You can hook into this lifecycle using annotations to perform setup, initialization, and cleanup tasks.

## Lifecycle Phases

1. **Construction** - Class instantiation
2. **Initialization** - `@AppInit` methods execute
3. **Running** - Message processing begins
4. **Shutdown** - `@AppShutdown` methods execute

## Topics

* [**Implementing Lifecycle Methods**](/talon/developing-applications/authoring-user-code/lifecycle/implementing-lifecycle-methods.md) - Use `@AppInit` and `@AppShutdown` annotations
* [**Initializing the Microservice**](/talon/developing-applications/authoring-user-code/lifecycle/initializing-the-microservice.md) - Handle first and initial messages for state initialization

## Related Topics

* [Application Lifecycle](/talon/concepts-and-architecture/microservice-operation/lifecycle.md) - Conceptual overview of the full lifecycle
