<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Concepts on Davish.Sendr</title><link>https://davidchen617.github.io/Davish.Sendr/concepts/</link><description>Recent content in Concepts on Davish.Sendr</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://davidchen617.github.io/Davish.Sendr/concepts/index.xml" rel="self" type="application/rss+xml"/><item><title>Dispatch model</title><link>https://davidchen617.github.io/Davish.Sendr/concepts/dispatch-model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/concepts/dispatch-model/</guid><description>&lt;h2 id="three-independent-message-kinds"&gt;Three independent message kinds&lt;a class="anchor" href="#three-independent-message-kinds"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Davish.Sendr has three kinds of message contracts, all dispatched through &lt;code&gt;ISender&lt;/code&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;IRequest&lt;/code&gt; / &lt;code&gt;IRequest&amp;lt;TResponse&amp;gt;&lt;/code&gt; — general request/response.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ICommand&lt;/code&gt; / &lt;code&gt;ICommand&amp;lt;TResponse&amp;gt;&lt;/code&gt; — explicit CQRS command contracts.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;IQuery&amp;lt;TResponse&amp;gt;&lt;/code&gt; — explicit CQRS query contracts.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;code&gt;ICommand&lt;/code&gt;/&lt;code&gt;IQuery&lt;/code&gt; are independent of &lt;code&gt;IRequest&lt;/code&gt; — a command handler implements&#10;&lt;code&gt;ICommandHandler&lt;/code&gt;, not &lt;code&gt;IRequestHandler&lt;/code&gt;. Each kind has its own handler interface,&#10;&lt;code&gt;ISender.SendAsync&lt;/code&gt; overload, registration method&#10;(&lt;code&gt;AddRequestHandler&lt;/code&gt;/&lt;code&gt;AddCommandHandler&lt;/code&gt;/&lt;code&gt;AddQueryHandler&lt;/code&gt;), and decorator interface. At the&#10;call site, &lt;code&gt;ISender.SendAsync&lt;/code&gt; picks the right overload from the argument&amp;rsquo;s static type, so&#10;callers don&amp;rsquo;t need to know which kind a message belongs to.&lt;/p&gt;</description></item><item><title>Decorator pipeline</title><link>https://davidchen617.github.io/Davish.Sendr/concepts/decorator-pipeline/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/concepts/decorator-pipeline/</guid><description>&lt;p&gt;A decorator is a non-generic pipeline behavior that wraps handler execution — logging,&#10;transactions, validation, and similar cross-cutting concerns. &amp;ldquo;Non-generic&amp;rdquo; means one&#10;decorator class can wrap any number of unrelated request/command/query/stream/notification&#10;types, unlike a handler, which is written against one specific message type.&lt;/p&gt;&#10;&lt;h2 id="one-interface-per-message-kind-plus-a-response-variant"&gt;One interface per message kind, plus a response variant&lt;a class="anchor" href="#one-interface-per-message-kind-plus-a-response-variant"&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;Message kind&lt;/th&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;th&gt;Decorator interface&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;IRequest&lt;/code&gt; (no response)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;IRequestDecorator&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;IRequest&amp;lt;TResponse&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;IRequestDecorator.WithResponse&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;ICommand&lt;/code&gt; (no response)&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;ICommandDecorator&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;ICommand&amp;lt;TResponse&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;ICommandDecorator.WithResponse&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;IQuery&amp;lt;TResponse&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;IQueryDecorator&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;IStreamRequest&amp;lt;TResponse&amp;gt;&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;IStreamRequestDecorator&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;INotification&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&#9;&#9;&lt;td&gt;&lt;code&gt;INotificationDecorator&lt;/code&gt;&lt;/td&gt;&#10;&#9;&#9;&#9;&lt;/tr&gt;&#10;&#9;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;p&gt;A class can implement both the no-response and &lt;code&gt;WithResponse&lt;/code&gt; variants of a kind at once&#10;(the README&amp;rsquo;s &lt;code&gt;LoggingDecorator&lt;/code&gt; example implements both &lt;code&gt;IRequestDecorator&lt;/code&gt; and&#10;&lt;code&gt;IRequestDecorator.WithResponse&lt;/code&gt;), letting one decorator wrap every shape of that kind.&lt;/p&gt;</description></item><item><title>Notification model</title><link>https://davidchen617.github.io/Davish.Sendr/concepts/notification-model/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/concepts/notification-model/</guid><description>&lt;h2 id="zero-or-more-handlers-in-two-groups"&gt;Zero or more handlers, in two groups&lt;a class="anchor" href="#zero-or-more-handlers-in-two-groups"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Unlike a request/command/query (exactly one handler), an &lt;code&gt;INotification&lt;/code&gt; can have any number&#10;of handlers, including zero. &lt;code&gt;IPublisher.PublishAsync&lt;/code&gt; with no registered handlers for the&#10;notification&amp;rsquo;s type is a no-op.&lt;/p&gt;&#10;&lt;p&gt;Handlers for a given notification type are organized into two named groups:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Sequence&lt;/strong&gt; — runs one handler at a time, in registration order. A handler that throws&#10;does not stop the remaining Sequence handlers from running.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Parallel&lt;/strong&gt; — starts every handler in the group concurrently.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The Sequence group and the Parallel group run concurrently &lt;em&gt;with each other&lt;/em&gt; — a Parallel&#10;handler does not wait for the Sequence group to finish, and vice versa:&lt;/p&gt;</description></item><item><title>Compile-time discovery</title><link>https://davidchen617.github.io/Davish.Sendr/concepts/compile-time-discovery/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://davidchen617.github.io/Davish.Sendr/concepts/compile-time-discovery/</guid><description>&lt;p&gt;&lt;code&gt;Davish.Sendr.Generators&lt;/code&gt; is a Roslyn incremental source generator. It discovers handler&#10;implementations at compile time and emits a reflection-free &lt;code&gt;ISender&lt;/code&gt;/&lt;code&gt;IStreamSender&lt;/code&gt;&#10;(and, separately, a reflection-free &lt;code&gt;IPublisher&lt;/code&gt; for notifications), avoiding both runtime&#10;assembly scanning and reflection-based invocation. Manual registration (see&#10;&lt;a href="https://davidchen617.github.io/Davish.Sendr/concepts/dispatch-model/"&gt;Dispatch model&lt;/a&gt;) never scans assemblies either, but still resolves and&#10;invokes handlers reflectively at dispatch time; the generator removes that reflection too.&lt;/p&gt;&#10;&lt;h2 id="opting-in"&gt;Opting in&lt;a class="anchor" href="#opting-in"&gt;&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;AddSendr(o =&amp;gt; o.UseGenerators())&lt;/code&gt; installs the generated sender; &lt;code&gt;AddSendr()&lt;/code&gt; alone keeps&#10;the default reflection-based one. The two are mutually exclusive per application — once&#10;&lt;code&gt;UseGenerators()&lt;/code&gt; is active, manual &lt;code&gt;AddRequestHandler&lt;/code&gt;/&lt;code&gt;AddCommandHandler&lt;/code&gt;/&lt;code&gt;AddQueryHandler&lt;/code&gt;/&#10;&lt;code&gt;AddStreamRequestHandler&lt;/code&gt; calls do not extend the generated dispatch table. The same relationship&#10;holds independently for notifications, via &lt;code&gt;AddSendrNotification(o =&amp;gt; o.UseGenerators())&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>