> For the complete documentation index, see [llms.txt](https://docs.rumi.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rumi.systems/rumi-core/guides/developing-applications/microservice-template.md).

# Microservice Template

Rumi provides two built-in microservice templates that implement different consensus models for maintaining state consistency across clustered microservice instances.

## Available Templates

### [State Replication Template](/rumi-core/guides/developing-applications/microservice-template/state-replication-template.md)

Uses Rumi's State Replication consensus model where state changes are automatically replicated across all instances by the runtime. State is modeled using ADM (Application Data Model) and is transparent to the Rumi runtime.

**Best for:** Applications requiring automatic state synchronization with minimal coding effort.

### [Event Sourcing Template](/rumi-core/guides/developing-applications/microservice-template/event-sourcing-template.md)

Uses Rumi's Event Sourcing consensus model where state is maintained by replaying a deterministic sequence of events. State is opaque to the Rumi runtime and maintained in your POJO objects.

**Best for:** Applications requiring full control over state management and complex business logic.

## Choosing a Template

Both templates provide high-availability and fault tolerance but differ in how they achieve consistency:

* **State Replication**: Runtime manages state synchronization automatically
* **Event Sourcing**: Application code replays events to rebuild state

For a detailed comparison, see [Consensus Models](/rumi-core/concepts/consensus-models.md).

{% hint style="info" %}
**Documentation Status**: This section is currently being migrated from our legacy documentation site. For complete content, please visit:

* [Working with State Replication](https://docs.neeveresearch.com/display/TALONDOC/Working+with+State+Replication) (legacy docs)
* [Working with Event Sourcing](https://docs.neeveresearch.com/display/TALONDOC/Working+with+Event+Sourcing) (legacy docs)

Complete documentation will be available here soon.
{% endhint %}

## Next Steps

* Review [Consensus Models](/rumi-core/concepts/consensus-models.md) to understand the differences
* Choose the template that fits your application requirements
* Follow the template-specific guide for implementation details


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.rumi.systems/rumi-core/guides/developing-applications/microservice-template.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
