<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>State management on Dapr Docs</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/</link><description>Recent content in State management on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/index.xml" rel="self" type="application/rss+xml"/><item><title>State management overview</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/state-management-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/state-management-overview/</guid><description>&lt;p>Your application can use Dapr&amp;rsquo;s state management API to save, read, and query key/value pairs in the &lt;a href="https://v1-18.docs.dapr.io/reference/components-reference/supported-state-stores/">supported state stores&lt;/a>. Using a state store component, you can build stateful, long running applications that save and retrieve their state (like a shopping cart or a game&amp;rsquo;s session state). For example, in the diagram below:&lt;/p>
&lt;ul>
&lt;li>Use &lt;strong>HTTP POST&lt;/strong> to save or query key/value pairs.&lt;/li>
&lt;li>Use &lt;strong>HTTP GET&lt;/strong> to read a specific key and have its value returned.&lt;/li>
&lt;/ul>
&lt;img src="https://v1-18.docs.dapr.io/images/state-management-overview.png" width=1000 style="padding-bottom:25px;">
&lt;p>&lt;a href="https://www.youtube.com/live/0y7ne6teHT4?si=2_xX6mkU3UCy2Plr&amp;amp;t=6607">The following overview video and demo&lt;/a> demonstrates how Dapr state management works.&lt;/p></description></item><item><title>How-To: Save and get state</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-get-save-state/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-get-save-state/</guid><description>&lt;p>State management is one of the most common needs of any new, legacy, monolith, or microservice application. Dealing with and testing different database libraries and handling retries and faults can be both difficult and time consuming.&lt;/p>
&lt;p>In this guide, you&amp;rsquo;ll learn the basics of using the key/value state API to allow an application to save, get, and delete state.&lt;/p>
&lt;p>The code example below &lt;em>loosely&lt;/em> describes an application that processes orders with an order processing service which has a Dapr sidecar. The order processing service uses Dapr to store state in a Redis state store.&lt;/p></description></item><item><title>How-To: Query state</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-state-query-api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-state-query-api/</guid><description>&lt;div class="alert alert-warning" role="alert">
&lt;h4 class="alert-heading">alpha&lt;/h4>

 The state query API is in &lt;strong>alpha&lt;/strong> stage.

&lt;/div>

&lt;p>With the state query API, you can retrieve, filter, and sort the key/value data stored in state store components. The query API is not a replacement for a complete query language.&lt;/p>
&lt;p>Even though the state store is a key/value store, the &lt;code>value&lt;/code> might be a JSON document with its own hierarchy, keys, and values. The query API allows you to use those keys/values to retrieve corresponding documents.&lt;/p></description></item><item><title>How-To: Build a stateful service</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-stateful-service/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-stateful-service/</guid><description>&lt;p>In this article, you&amp;rsquo;ll learn how to create a stateful service which can be horizontally scaled, using opt-in concurrency and consistency models. Consuming the state management API frees developers from difficult state coordination, conflict resolution, and failure handling.&lt;/p>
&lt;h2 id="set-up-a-state-store">Set up a state store&lt;/h2>
&lt;p>A state store component represents a resource that Dapr uses to communicate with a database.
For the purpose of this guide, we&amp;rsquo;ll use the default Redis state store.&lt;/p></description></item><item><title>How-To: Enable the transactional outbox pattern</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-outbox/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-outbox/</guid><description>&lt;p>The transactional outbox pattern is a well known design pattern for sending notifications regarding changes in an application&amp;rsquo;s state. The transactional outbox pattern uses a single transaction that spans across the database and the message broker delivering the notification.&lt;/p>
&lt;p>Developers are faced with many difficult technical challenges when trying to implement this pattern on their own, which often involves writing error-prone central coordination managers that, at most, support a combination of one or two databases and message brokers.&lt;/p></description></item><item><title>How-To: Share state between applications</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-share-state/</guid><description>&lt;p>Dapr provides different ways to share state between applications.&lt;/p>
&lt;p>Different architectures might have different needs when it comes to sharing state. In one scenario, you may want to:&lt;/p>
&lt;ul>
&lt;li>Encapsulate all state within a given application&lt;/li>
&lt;li>Have Dapr manage the access for you&lt;/li>
&lt;/ul>
&lt;p>In a different scenario, you may need two applications working on the same state to get and save the same keys.&lt;/p>
&lt;p>To enable state sharing, Dapr supports the following key prefixes strategies:&lt;/p></description></item><item><title>How-To: Encrypt application state</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-encrypt-state/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/howto-encrypt-state/</guid><description>&lt;p>Encrypt application state at rest to provide stronger security in enterprise workloads or regulated environments. Dapr offers automatic client-side encryption based on &lt;a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES&lt;/a> in &lt;a href="https://en.wikipedia.org/wiki/Galois/Counter_Mode">Galois/Counter Mode (GCM)&lt;/a>, supporting keys of 128, 192, and 256-bits.&lt;/p>
&lt;p>In addition to automatic encryption, Dapr supports primary and secondary encryption keys to make it easier for developers and ops teams to enable a key rotation strategy. This feature is supported by all Dapr state stores.&lt;/p>
&lt;p>The encryption keys are always fetched from a secret, and cannot be supplied as plaintext values on the &lt;code>metadata&lt;/code> section.&lt;/p></description></item><item><title>State Time-to-Live (TTL)</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/state-store-ttl/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/state-management/state-store-ttl/</guid><description>&lt;p>Dapr enables per state set request time-to-live (TTL). This means that applications can set time-to-live per state stored, and these states cannot be retrieved after expiration.&lt;/p>
&lt;p>For &lt;a href="https://v1-18.docs.dapr.io/reference/components-reference/supported-state-stores/">supported state stores&lt;/a>, you simply set the &lt;code>ttlInSeconds&lt;/code> metadata when publishing a message. Other state stores will ignore this value. For some state stores, you can specify a default expiration on a per-table/container basis.&lt;/p>
&lt;h2 id="native-state-ttl-support">Native state TTL support&lt;/h2>
&lt;p>When state TTL has native support in the state store component, Dapr forwards the TTL configuration without adding any extra logic, maintaining predictable behavior. This is helpful when the expired state is handled differently by the component.&lt;/p></description></item></channel></rss>