Skip to content
Deedboxlatest

Wire QueueBox

This guide shows you how to send events to other systems with QueueBox. Deedbox writes a QueueBox outbox row in the append’s transaction, so a message exists exactly when its event commits. QueueBox delivers it, with retries, at least once.

  1. Run QueueBox against the same database, and let it create its outbox table.

  2. Add the package:

    Terminal window
    dotnet add package Deedbox.QueueBox --prerelease
  3. Choose the events to publish:

    services.AddDeedbox(es => es
    .UsePostgres(connStr)
    .Keys(keys => keys.FromEnvironment("DEEDBOX_MASTER_KEY"))
    .Stream<Cart>(s => s.Events<ItemAdded, CheckedOut>())
    .Stream<Manuscript>(s => s.Events<ReviewerInvited, CoAuthorAdded>())
    .UseQueueBox(q => q
    .Publish<CheckedOut>("cart.checked_out")
    // Events with [PersonalData] need a payload you shape, so no personal data leaks by default.
    .Publish<ReviewerInvited>("review.invited", (e, info) => new { e.ManuscriptId, e.ReviewerId })
    // Tell downstream systems to erase too.
    .Publish<SubjectErased>("privacy.subject_erased")));
Column Value
id The event ID. A destination deduplicates on X-Message-Id.
topic The topic you chose.
key The stream ID, so one stream’s messages keep their order.
payload The event’s JSON, or the payload you shaped.
headers X-Correlation-Id, traceparent, and the event’s type, stream and version.
aggregate_type The stream type.

An event with [PersonalData] needs a payload you shape; start-up fails otherwise (DBX032).

If QueueBox runs with a custom table or column mapping, match it with UseTable and UseColumns.