<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Reference on Davish.Sendr</title><link>https://davidchen617.github.io/Davish.Sendr/reference/</link><description>Recent content in Reference on Davish.Sendr</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://davidchen617.github.io/Davish.Sendr/reference/index.xml" rel="self" type="application/rss+xml"/><item><title>Packages</title><link>https://davidchen617.github.io/Davish.Sendr/reference/packages/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/reference/packages/</guid><description>&lt;p&gt;Every package this repository produces, its purpose, and its current version (from each&#10;project&amp;rsquo;s &lt;code&gt;.csproj&lt;/code&gt;; check the &lt;code&gt;.csproj&lt;/code&gt; for the current value, since this table is a&#10;snapshot).&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;PackageId&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Version&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Status&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Purpose&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;3.6.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Current&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Request/response and stream dispatch, notification publishing, decorator pipeline, tracing (&lt;code&gt;SendrActivitySource&lt;/code&gt;), DI registration (&lt;code&gt;AddSendr&lt;/code&gt;, &lt;code&gt;AddSendrNotification&lt;/code&gt;). Depends on &lt;code&gt;Davish.Sendr.Abstractions&lt;/code&gt;.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr.Abstractions&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;4.0.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Current&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Contracts only: &lt;code&gt;IRequest&lt;/code&gt;, &lt;code&gt;IRequestHandler&lt;/code&gt;, &lt;code&gt;IRequestDecorator&lt;/code&gt;, &lt;code&gt;ISender&lt;/code&gt;, &lt;code&gt;ICommand&lt;/code&gt;, &lt;code&gt;IQuery&lt;/code&gt;, &lt;code&gt;INotification&lt;/code&gt;, &lt;code&gt;INotificationHandler&lt;/code&gt;, &lt;code&gt;INotificationDecorator&lt;/code&gt;, &lt;code&gt;IPublisher&lt;/code&gt;, and related types. No DI implementation.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr.Generators&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2.2.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Current, opt-in&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Roslyn incremental source generator: compile-time handler discovery, &lt;code&gt;[DecorateWith&amp;lt;...&amp;gt;]&lt;/code&gt; wiring, reflection-free &lt;code&gt;ISender&lt;/code&gt;/&lt;code&gt;IStreamSender&lt;/code&gt;/&lt;code&gt;IPublisher&lt;/code&gt; via &lt;code&gt;UseGenerators()&lt;/code&gt;.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr.Message&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;2.0.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Deprecated&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Compatibility shim for &lt;code&gt;ICommand&lt;/code&gt;/&lt;code&gt;ICommandHandler&lt;/code&gt;/&lt;code&gt;IQuery&lt;/code&gt;/&lt;code&gt;IQueryHandler&lt;/code&gt;, now in &lt;code&gt;Davish.Sendr.Abstractions&lt;/code&gt;. No content of its own; will be removed in a future major version.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr.Notification&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;3.0.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Deprecated&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Compatibility shim for notification publishing (&lt;code&gt;IPublisher&lt;/code&gt;, &lt;code&gt;AddSendrNotification&lt;/code&gt;, &lt;code&gt;AddNotificationHandler&lt;/code&gt;, …), now in &lt;code&gt;Davish.Sendr&lt;/code&gt;. No content of its own; will be removed in a future major version.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Davish.Sendr.Notification.Abstractions&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;4.0.0&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Deprecated&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Compatibility shim for &lt;code&gt;INotification&lt;/code&gt;/&lt;code&gt;INotificationHandler&lt;/code&gt;/&lt;code&gt;INotificationDecorator&lt;/code&gt;/&lt;code&gt;IPublisher&lt;/code&gt; contracts, now in &lt;code&gt;Davish.Sendr.Abstractions&lt;/code&gt;. No content of its own; will be removed in a future major version.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;See &lt;a href="https://davidchen617.github.io/Davish.Sendr/guides/migrating-from-deprecated-packages/"&gt;Migrating from deprecated packages&lt;/a&gt;&#10;for moving off the deprecated ones.&lt;/p&gt;</description></item><item><title>Exceptions and diagnostics</title><link>https://davidchen617.github.io/Davish.Sendr/reference/exceptions-and-diagnostics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/reference/exceptions-and-diagnostics/</guid><description>&lt;h2 id="runtime-exceptions"&gt;Runtime exceptions&lt;a class="anchor" href="#runtime-exceptions"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;h3 id="missing-handler--invalidoperationexception"&gt;Missing handler — &lt;code&gt;InvalidOperationException&lt;/code&gt;&lt;a class="anchor" href="#missing-handler--invalidoperationexception"&gt;&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Thrown when dispatching a request/command/query/stream with no registered handler (for&#10;streams, when enumeration starts). The message names the specific registration call that&amp;rsquo;s&#10;missing:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Davish.Sendr: no handler is registered for &amp;#39;&amp;lt;requestType&amp;gt;&amp;#39;. Call services.&amp;lt;registrationMethod&amp;gt;&amp;lt;&amp;lt;requestType&amp;gt;, YourHandler&amp;gt;() during startup.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or, for a request/command/query with a response type:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Davish.Sendr: no handler is registered for &amp;#39;&amp;lt;requestType&amp;gt;&amp;#39; with response &amp;#39;&amp;lt;responseType&amp;gt;&amp;#39;. Call services.&amp;lt;registrationMethod&amp;gt;&amp;lt;&amp;lt;requestType&amp;gt;, &amp;lt;responseType&amp;gt;, YourHandler&amp;gt;() during startup.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;&amp;lt;registrationMethod&amp;gt;&lt;/code&gt; is whichever of &lt;code&gt;AddRequestHandler&lt;/code&gt;/&lt;code&gt;AddCommandHandler&lt;/code&gt;/&#10;&lt;code&gt;AddQueryHandler&lt;/code&gt;/&lt;code&gt;AddStreamRequestHandler&lt;/code&gt; matches the message&amp;rsquo;s kind.&lt;/p&gt;</description></item><item><title>Extensibility</title><link>https://davidchen617.github.io/Davish.Sendr/reference/extensibility/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/reference/extensibility/</guid><description>&lt;p&gt;For plugging in a custom &lt;code&gt;ISender&lt;/code&gt;/&lt;code&gt;IStreamSender&lt;/code&gt; or &lt;code&gt;IPublisher&lt;/code&gt; implementation instead of&#10;the default reflection-based one or the generated one.&lt;/p&gt;&#10;&lt;h2 id="sendroptions"&gt;&lt;code&gt;SendrOptions&lt;/code&gt;&lt;a class="anchor" href="#sendroptions"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Passed to the &lt;code&gt;configure&lt;/code&gt; delegate of &lt;code&gt;AddSendr(configure)&lt;/code&gt;.&lt;/p&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Member&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Signature&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Notes&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Services&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;IServiceCollection Services { get; }&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;The collection being configured by &lt;code&gt;AddSendr&lt;/code&gt;. An extension (such as the generated &lt;code&gt;UseGenerators()&lt;/code&gt;) uses this to register handlers/decorators alongside a custom sender.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;UseSender&amp;lt;TSender&amp;gt;()&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;SendrOptions UseSender&amp;lt;TSender&amp;gt;() where TSender : class, ISender, IStreamSender&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Registers &lt;code&gt;TSender&lt;/code&gt; as both &lt;code&gt;ISender&lt;/code&gt; and &lt;code&gt;IStreamSender&lt;/code&gt;, replacing the default sender. Returns &lt;code&gt;this&lt;/code&gt; for chaining. This is what &lt;code&gt;UseGenerators()&lt;/code&gt; calls internally to install the generated sender.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;&lt;code&gt;TSender&lt;/code&gt; is resolved as the same instance for both &lt;code&gt;ISender&lt;/code&gt; and &lt;code&gt;IStreamSender&lt;/code&gt; within a&#10;scope (&lt;code&gt;IStreamSender&lt;/code&gt; resolves through &lt;code&gt;ISender&lt;/code&gt; rather than constructing its own&#10;instance), but each interface is still its own DI registration. If &lt;code&gt;TSender&lt;/code&gt; is&#10;&lt;code&gt;IDisposable&lt;/code&gt;/&lt;code&gt;IAsyncDisposable&lt;/code&gt;, a scope that resolves both interfaces causes the container&#10;to invoke disposal once per registration (twice total) — implement disposal idempotently.&lt;/p&gt;</description></item><item><title>Tracing spans and tags</title><link>https://davidchen617.github.io/Davish.Sendr/reference/tracing-spans-and-tags/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/reference/tracing-spans-and-tags/</guid><description>&lt;p&gt;Every span comes from the &lt;code&gt;ActivitySource&lt;/code&gt; named &lt;code&gt;Davish.Sendr&lt;/code&gt;&#10;(&lt;code&gt;SendrActivitySource.Name&lt;/code&gt;) and has &lt;code&gt;ActivityKind.Internal&lt;/code&gt;. How to subscribe to it is in&#10;&lt;a href="https://davidchen617.github.io/Davish.Sendr/guides/tracing/"&gt;Tracing&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="spans"&gt;Spans&lt;a class="anchor" href="#spans"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;table&gt;&#10;&#9;&lt;thead&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Span&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Display name&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Emitted for&lt;/th&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/thead&gt;&#10;&#9;&lt;tbody&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Send&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Send &amp;lt;TypeName&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Each &lt;code&gt;ISender.SendAsync&lt;/code&gt; call for a request, command, or query.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Publish&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Publish &amp;lt;TypeName&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Each &lt;code&gt;IPublisher.PublishAsync&lt;/code&gt; call whose notification has at least one handler.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&#9;&#9;&lt;tr&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Handle&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;Handle &amp;lt;HandlerTypeName&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;Each notification handler that runs, including its decorators. A child of the &lt;code&gt;Publish&lt;/code&gt; span.&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;&lt;code&gt;&amp;lt;TypeName&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;HandlerTypeName&amp;gt;&lt;/code&gt; are the type&amp;rsquo;s short name without its namespace. The&#10;full name is in a tag.&lt;/p&gt;</description></item><item><title>Limitations</title><link>https://davidchen617.github.io/Davish.Sendr/reference/limitations/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/reference/limitations/</guid><description>&lt;p&gt;Behavior that is by design but easy to run into.&lt;/p&gt;&#10;&lt;h2 id="one-class-several-handler-interfaces"&gt;One class, several handler interfaces&lt;a class="anchor" href="#one-class-several-handler-interfaces"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;[DecorateWith&amp;lt;...&amp;gt;]&lt;/code&gt; applies to every handler interface the class implements. The generator&#10;checks each decorator against the decorator interface of every message kind the class handles.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-csharp" data-lang="csharp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;[DecorateWith&amp;lt;AuditCommandDecorator&amp;gt;]&lt;/span&gt; &lt;span style="color:#75715e"&gt;// implements ICommandDecorator only&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;public&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;sealed&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;class&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;OrderHandlers&lt;/span&gt; : ICommandHandler&amp;lt;PlaceOrder&amp;gt;, IQueryHandler&amp;lt;GetOrder, OrderDto&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// ...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This reports &lt;code&gt;SENDR001&lt;/code&gt;: &lt;code&gt;'AuditCommandDecorator' does not implement Davish.Sendr.IQueryDecorator, required to decorate 'OrderHandlers'.&lt;/code&gt;&lt;/p&gt;&#10;&lt;p&gt;What to do:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Split the class into one handler per message, and put &lt;code&gt;[DecorateWith&amp;lt;...&amp;gt;]&lt;/code&gt; only on the handlers&#10;that need it.&lt;/li&gt;&#10;&lt;li&gt;Or use a decorator that implements every decorator interface the class needs (here,&#10;&lt;code&gt;ICommandDecorator&lt;/code&gt; and &lt;code&gt;IQueryDecorator&lt;/code&gt;).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="a-derived-request-is-not-dispatched-to-the-base-handler"&gt;A derived request is not dispatched to the base handler&lt;a class="anchor" href="#a-derived-request-is-not-dispatched-to-the-base-handler"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Both senders look up the handler by the message&amp;rsquo;s runtime type, and Microsoft.Extensions.DependencyInjection&#10;does not resolve variant handler types. A handler for a base type does not handle a derived type:&lt;/p&gt;</description></item></channel></rss>