<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Messaging :: Juice&#39;s documentation</title>
    <link>https://docs.pavellis.com/core/messaging/index.html</link>
    <description>Juice v9 unifies all message types under a single IMessage hierarchy and introduces a MessagingBuilder entry point that composes the outbox, delivery, idempotency, and broker layers with a single services.AddMessaging() call.&#xA;IMessage Hierarchy Every message type in Juice v9 — MediatR commands, domain events, and integration events — implements IMessage, giving them a shared identity (MessageId, CreatedAt, TenantId).&#xA;IMessage&#xD;├── MessageId : Guid&#xD;├── CreatedAt : DateTimeOffset&#xD;└── TenantId : string?&#xD;IEvent : IMessage&#xD;└── EventName : string&#xD;IIntegrationEvent : IEvent ← required only on the CONSUMING side&#xD;└── (marker — enables dispatcher routing)&#xD;MessageBase (abstract record) : IMessage&#xD;└── MessageId = Guid.NewGuid(), CreatedAt = UtcNow (defaults)&#xD;IntegrationEvent (abstract record) : MessageBase, IIntegrationEvent&#xD;└── EventName → GetType().Name (default) ← optional to customizing the routing key on the PRODUCER side&#xD;Publish vs. Consume roles Role Type required Reason Publishing (outbox staging) Any IMessage Outbox accepts any message including plain domain events Consuming (broker dispatch) Must implement IIntegrationEvent IntegrationEventDispatcher uses EventName + type registry to deserialize and route from raw bytes Key insight: A plain domain event (IMessage) can be published and delivered through the outbox without ever implementing IIntegrationEvent if you do not want to customizing the event name. Only services that need to receive it via broker infrastructure must use IIntegrationEvent.</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 14 Mar 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://docs.pavellis.com/core/messaging/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>MessageContext</title>
      <link>https://docs.pavellis.com/core/messaging/message-context/index.html</link>
      <pubDate>Sat, 14 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/message-context/index.html</guid>
      <description>Overview MessageContext is an AsyncLocal-based context that carries correlation, causation, and source identity across async call chains. Every message produced by the Juice messaging pipeline stamps the current MessageContext values into outbox headers, enabling distributed tracing and idempotency across service boundaries. For OpenTelemetry traces and metrics, which carry these ids as tags next to the W3C trace context, see Observability.&#xA;MessageContext must be initialized at every entry point — HTTP requests, background consumers, test methods, and hosted services. If not initialized, any code that reads MessageContext.Current will throw InvalidOperationException.</description>
    </item>
    <item>
      <title>Outbox Setup</title>
      <link>https://docs.pavellis.com/core/messaging/outbox/index.html</link>
      <pubDate>Thu, 19 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/outbox/index.html</guid>
      <description>Overview The Outbox pattern ensures messages are staged within the same database transaction as your domain changes, so no message is ever lost if the broker is unavailable at commit time. The IOutboxService&lt;TContext&gt; stores events in an OutboxEvent table inside your DbContext transaction; a separate DeliveryHostedService picks them up and forwards them to the broker.&#xA;When to use Your command handler modifies domain state and must publish a message atomically You are replacing direct IEventBus.PublishAsync() calls from v8.5.0 You want to publish plain domain events without converting them to IntegrationEvent The delivery worker may run in a separate process or be added later Prerequisites Internal Messaging Setup — required for TransactionBehavior’s DbContext dependency injection.</description>
    </item>
    <item>
      <title>Delivery Setup</title>
      <link>https://docs.pavellis.com/core/messaging/delivery/index.html</link>
      <pubDate>Thu, 19 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/delivery/index.html</guid>
      <description>Overview The Delivery setup registers DeliveryHostedService, a background worker that reads OutboxDelivery records from the database and forwards them to the broker transport (e.g., RabbitMQ). It operates independently of the outbox staging layer and can run in the same process or in a dedicated worker service.&#xA;When to use You have Outbox Setup configured and need a delivery worker You want to run the delivery worker in a separate process from the outbox-writing service You need retry backoff, stuck-message recovery, and a health check for the delivery backlog Prerequisites Outbox Setup — the OutboxEvent and OutboxDelivery tables must exist and be populated by IOutboxService&lt;TContext&gt;.</description>
    </item>
    <item>
      <title>Local Transport</title>
      <link>https://docs.pavellis.com/core/messaging/local-transport/index.html</link>
      <pubDate>Sat, 14 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/local-transport/index.html</guid>
      <description>Overview The Local Transport adds two in-process delivery routes and a unified IMessageService publishing interface. Messages can be dispatched to handlers within the same process without requiring a broker, while still supporting configuration-driven routing that can switch between local and broker delivery with no code changes.&#xA;Route Publisher Key Durable? Latency Use case In-memory channel &#34;local-channel&#34; No Immediate Fast fire-and-forget: cache invalidation, lightweight side-effects Outbox + in-process &#34;local&#34; Yes Near-immediate Reliable cross-aggregate events within the same service Outbox + broker &#34;rabbitmq&#34; Yes Polling interval Cross-service messaging (existing) &#34;local-channel&#34; and &#34;local&#34; are mutually exclusive. If a publishing policy resolves both routes for the same event, &#34;local&#34; takes precedence — it is the durable superset (outbox write + immediate in-process dispatch). The &#34;local-channel&#34; route is ignored to prevent double handler invocation. Use one or the other per event type.</description>
    </item>
    <item>
      <title>Consumption Setup</title>
      <link>https://docs.pavellis.com/core/messaging/consumption/index.html</link>
      <pubDate>Thu, 19 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/consumption/index.html</guid>
      <description>Overview The Consumption setup registers a RabbitMQ consumer engine that deserializes incoming messages from a queue, routes them to the correct IIntegrationEventHandler&lt;T&gt;, and automatically deduplicates re-delivered messages using IIdempotencyService — with no handler code changes required.&#xA;When to use Your service needs to receive integration events published by other services You want automatic idempotent event handling without writing deduplication logic in handlers You need dead-letter exchange (DLX) support for unhandled or failed messages Prerequisites Internal Messaging Setup — required for IIdempotencyService registration, which IntegrationEventDispatcher resolves at startup.</description>
    </item>
    <item>
      <title>Full Pipeline Setup</title>
      <link>https://docs.pavellis.com/core/messaging/full-setup/index.html</link>
      <pubDate>Thu, 19 Feb 2026 00:00:00 +0000</pubDate>
      <guid>https://docs.pavellis.com/core/messaging/full-setup/index.html</guid>
      <description>Overview This guide combines all four messaging capabilities — internal MediatR idempotency, transactional outbox staging, background delivery, and RabbitMQ consumption — into a single, coherent services.AddMessaging() call. Follow this guide for new services or when you want the complete picture before choosing an incremental approach.&#xA;Prerequisites Either:&#xA;Complete the four individual setup guides (Internal Messaging, Outbox, Delivery, Consumption), OR Follow this guide from scratch NuGet packages Install all packages from the setup guides:</description>
    </item>
  </channel>
</rss>