<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Actors on Dapr Docs</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/</link><description>Recent content in Actors on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/index.xml" rel="self" type="application/rss+xml"/><item><title>Actors overview</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-overview/</guid><description>&lt;p>The &lt;a href="https://en.wikipedia.org/wiki/Actor_model">actor pattern&lt;/a> describes actors as the lowest-level &amp;ldquo;unit of computation&amp;rdquo;. In other words, you write your code in a self-contained unit (called an actor) that receives messages and processes them one at a time, without any kind of concurrency or threading.&lt;/p>
&lt;p>While your code processes a message, it can send one or more messages to other actors, or create new actors. An underlying runtime manages how, when and where each actor runs, and also routes messages between actors.&lt;/p></description></item><item><title>Actor runtime features</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-features-concepts/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-features-concepts/</guid><description>&lt;p>Now that you&amp;rsquo;ve learned about the &lt;a href="https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-overview/">actor building block&lt;/a> at a high level, let&amp;rsquo;s deep dive into the features and concepts included with actors in Dapr.&lt;/p>
&lt;h2 id="actor-lifetime">Actor lifetime&lt;/h2>
&lt;p>Dapr actors are virtual, meaning that their lifetime is not tied to their in-memory representation. As a result, they do not need to be explicitly created or destroyed. The Dapr actor runtime automatically activates an actor the first time it receives a request for that actor ID. If an actor is not used for a period of time, the Dapr actor runtime garbage-collects the in-memory object. It will also maintain knowledge of the actor&amp;rsquo;s existence should it need to be reactivated later.&lt;/p></description></item><item><title>Actor runtime configuration parameters</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-runtime-config/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-runtime-config/</guid><description>&lt;p>You can modify the default Dapr actor runtime behavior using the following configuration parameters.&lt;/p>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Parameter&lt;/th>
 &lt;th>Description&lt;/th>
 &lt;th>Default&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>entities&lt;/code>&lt;/td>
 &lt;td>The actor types supported by this host.&lt;/td>
 &lt;td>N/A&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>actorIdleTimeout&lt;/code>&lt;/td>
 &lt;td>The timeout before deactivating an idle actor. Checks for timeouts occur every &lt;code>actorScanInterval&lt;/code> interval.&lt;/td>
 &lt;td>60 minutes&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>actorScanInterval&lt;/code>&lt;/td>
 &lt;td>The duration which specifies how often to scan for actors to deactivate idle actors. Actors that have been idle longer than actor_idle_timeout will be deactivated.&lt;/td>
 &lt;td>30 seconds&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>drainOngoingCallTimeout&lt;/code>&lt;/td>
 &lt;td>The duration when in the process of draining rebalanced actors. This specifies the timeout for the current active actor method to finish. If there is no current actor method call, this is ignored.&lt;/td>
 &lt;td>60 seconds&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>drainRebalancedActors&lt;/code>&lt;/td>
 &lt;td>If true, Dapr will wait for &lt;code>drainOngoingCallTimeout&lt;/code> duration to allow a current actor call to complete before trying to deactivate an actor.&lt;/td>
 &lt;td>true&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>reentrancy&lt;/code> (&lt;code>ActorReentrancyConfig&lt;/code>)&lt;/td>
 &lt;td>Configure the reentrancy behavior for an actor. If not provided, reentrancy is disabled.&lt;/td>
 &lt;td>disabled, false&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>entitiesConfig&lt;/code>&lt;/td>
 &lt;td>Configure each actor type individually with an array of configurations. Any entity specified in the individual entity configurations must also be specified in the top level &lt;code>entities&lt;/code> field.&lt;/td>
 &lt;td>N/A&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="examples">Examples&lt;/h2>












&lt;ul class="nav nav-tabs" id="tabs-0" role="tablist">
 &lt;li class="nav-item">
 &lt;button class="nav-link active"
 id="tabs-00-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-00" role="tab"
 data-td-tp-persist=".net" aria-controls="tabs-00-00" aria-selected="true">
 .NET
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-01" role="tab"
 data-td-tp-persist="javascript" aria-controls="tabs-00-01" aria-selected="false">
 JavaScript
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-02-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-02" role="tab"
 data-td-tp-persist="python" aria-controls="tabs-00-02" aria-selected="false">
 Python
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-03-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-03" role="tab"
 data-td-tp-persist="java" aria-controls="tabs-00-03" aria-selected="false">
 Java
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-00-04-tab" data-bs-toggle="tab" data-bs-target="#tabs-00-04" role="tab"
 data-td-tp-persist="go" aria-controls="tabs-00-04" aria-selected="false">
 Go
 &lt;/button>
 &lt;/li>
&lt;/ul>

&lt;div class="tab-content" id="tabs-0-content">
 &lt;div class="tab-body tab-pane fade show active"
 id="tabs-00-00" role="tabpanel" aria-labelled-by="tabs-00-00-tab" tabindex="0">
 &lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-csharp" data-lang="csharp">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8f5902;font-style:italic">// In Startup.cs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">public&lt;/span> &lt;span style="color:#204a87;font-weight:bold">void&lt;/span> &lt;span style="color:#000">ConfigureServices&lt;/span>&lt;span style="color:#000;font-weight:bold">(&lt;/span>&lt;span style="color:#000">IServiceCollection&lt;/span> &lt;span style="color:#000">services&lt;/span>&lt;span style="color:#000;font-weight:bold">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000;font-weight:bold">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// Register actor runtime with DI&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">services&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">AddActors&lt;/span>&lt;span style="color:#000;font-weight:bold">(&lt;/span>&lt;span style="color:#000">options&lt;/span> &lt;span style="color:#000;font-weight:bold">=&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// Register actor types and configure actor settings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">Actors&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">RegisterActor&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#000">MyActor&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;();&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// Configure default settings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">ActorIdleTimeout&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#000">TimeSpan&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">FromMinutes&lt;/span>&lt;span style="color:#000;font-weight:bold">(&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">60&lt;/span>&lt;span style="color:#000;font-weight:bold">);&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">ActorScanInterval&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#000">TimeSpan&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">FromSeconds&lt;/span>&lt;span style="color:#000;font-weight:bold">(&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">30&lt;/span>&lt;span style="color:#000;font-weight:bold">);&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">DrainOngoingCallTimeout&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#000">TimeSpan&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">FromSeconds&lt;/span>&lt;span style="color:#000;font-weight:bold">(&lt;/span>&lt;span style="color:#0000cf;font-weight:bold">60&lt;/span>&lt;span style="color:#000;font-weight:bold">);&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">DrainRebalancedActors&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">true&lt;/span>&lt;span style="color:#000;font-weight:bold">;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">ReentrancyConfig&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">new&lt;/span>&lt;span style="color:#000;font-weight:bold">()&lt;/span> &lt;span style="color:#000;font-weight:bold">{&lt;/span> &lt;span style="color:#000">Enabled&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">false&lt;/span> &lt;span style="color:#000;font-weight:bold">};&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// Add a configuration for a specific actor type.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// This actor type must have a matching value in the base level &amp;#39;entities&amp;#39; field. If it does not, the configuration will be ignored.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// If there is a matching entity, the values here will be used to overwrite any values specified in the root configuration.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// In this example, `ReentrantActor` has reentrancy enabled; however, &amp;#39;MyActor&amp;#39; will not have reentrancy enabled.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">options&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">Actors&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">RegisterActor&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#000">ReentrantActor&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;(&lt;/span>&lt;span style="color:#000">typeOptions&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span> &lt;span style="color:#204a87;font-weight:bold">new&lt;/span>&lt;span style="color:#000;font-weight:bold">()&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">ReentrancyConfig&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">new&lt;/span>&lt;span style="color:#000;font-weight:bold">()&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">{&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">Enabled&lt;/span> &lt;span style="color:#000;font-weight:bold">=&lt;/span> &lt;span style="color:#204a87;font-weight:bold">true&lt;/span>&lt;span style="color:#000;font-weight:bold">,&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">});&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000;font-weight:bold">});&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#8f5902;font-style:italic">// Register additional services for use with actors&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#000">services&lt;/span>&lt;span style="color:#000;font-weight:bold">.&lt;/span>&lt;span style="color:#000">AddSingleton&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#000">BankService&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;();&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000;font-weight:bold">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;a href="https://v1-18.docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors/dotnet-actors-usage/#registring-actors">See the .NET SDK documentation on registering actors&lt;/a>.&lt;/p></description></item><item><title>Namespaced actors</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/namespaced-actors/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/namespaced-actors/</guid><description>&lt;p>Namespacing in Dapr provides isolation, and thus multi-tenancy. With actor namespacing, the same actor type can be deployed into different namespaces. You can call instances of these actors in the same namespace.&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">Note&lt;/h4>

 Each namespaced actor deployment must use its own separate state store, especially if the same actor type is used across namespaces. In other words, no namespace information is written as part of the actor record, and hence separate state stores are required for each namespace. See &lt;a href="https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/namespaced-actors/#configuring-actor-state-stores-for-namespacing">Configuring actor state stores for namespacing&lt;/a> section for examples.

&lt;/div>

&lt;h2 id="creating-and-configuring-namespaces">Creating and configuring namespaces&lt;/h2>
&lt;p>You can use namespaces either in self-hosted mode or on Kubernetes.&lt;/p></description></item><item><title>Actors timers and reminders</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-timers-reminders/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actors-timers-reminders/</guid><description>&lt;p>Actors can schedule periodic work on themselves by registering either timers or reminders.&lt;/p>
&lt;p>The functionality of timers and reminders is very similar. The main difference is that Dapr actor runtime is not retaining any information about timers after deactivation, while persisting the information about reminders using Dapr &lt;a href="https://v1-18.docs.dapr.io/concepts/dapr-services/scheduler/">Scheduler&lt;/a>.&lt;/p>
&lt;p>This distinction allows users to trade off between light-weight but stateless timers vs. more resource-demanding but stateful reminders.&lt;/p>
&lt;p>The scheduling configuration of timers and reminders is summarized below:&lt;/p></description></item><item><title>How-to: Interact with virtual actors using scripting</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/howto-actors/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/howto-actors/</guid><description>&lt;p>Learn how to use virtual actors by calling HTTP/gRPC endpoints.&lt;/p>
&lt;h2 id="invoke-the-actor-method">Invoke the actor method&lt;/h2>
&lt;p>You can interact with Dapr to invoke the actor method by calling HTTP/gRPC endpoint.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-html" data-lang="html">&lt;span style="display:flex;">&lt;span>POST/GET/PUT/DELETE http://localhost:3500/v1.0/actors/&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#204a87;font-weight:bold">actorType&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;&lt;/span>/&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#204a87;font-weight:bold">actorId&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;&lt;/span>/method/&lt;span style="color:#000;font-weight:bold">&amp;lt;&lt;/span>&lt;span style="color:#204a87;font-weight:bold">method&lt;/span>&lt;span style="color:#000;font-weight:bold">&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Provide data for the actor method in the request body. The response for the request, which is data from actor method call, is in the response body.&lt;/p>
&lt;p>Refer &lt;a href="https://v1-18.docs.dapr.io/reference/api/actors_api/#invoke-actor-method">to the Actors API spec&lt;/a> for more details.&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">Note&lt;/h4>

 Alternatively, you can use &lt;a href="https://v1-18.docs.dapr.io/developing-applications/sdks/#sdk-languages">Dapr SDKs to use actors&lt;/a>.

&lt;/div>

&lt;h2 id="save-state-with-actors">Save state with actors&lt;/h2>
&lt;p>You can interact with Dapr via HTTP/gRPC endpoints to save state reliably using the Dapr actor state management capabaility.&lt;/p></description></item><item><title>How-to: Enable and use actor reentrancy in Dapr</title><link>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actor-reentrancy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/developing-applications/building-blocks/actors/actor-reentrancy/</guid><description>&lt;p>A core tenet of the &lt;a href="https://www.microsoft.com/research/project/orleans-virtual-actors/">virtual actor pattern&lt;/a> is the single-threaded nature of actor execution. Without reentrancy, the Dapr runtime locks on all actor requests. A second request wouldn&amp;rsquo;t be able to start until the first had completed. This means an actor cannot call itself, or have another actor call into it, even if it&amp;rsquo;s part of the same call chain.&lt;/p>
&lt;p>Reentrancy solves this by allowing requests from the same chain, or context, to re-enter into an already locked actor. This proves useful in scenarios where:&lt;/p></description></item></channel></rss>