Skip to content

v1.0.38 - #101

Merged
yilmaztayfun merged 7 commits into
release-v1.0from
master
Aug 31, 2026
Merged

v1.0.38#101
yilmaztayfun merged 7 commits into
release-v1.0from
master

Conversation

@yilmaztayfun

@yilmaztayfun yilmaztayfun commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Reduce event-processing latency with best-effort wakeup signals while preserving polling reliability and correct trace boundaries.

New Features:

  • Add configurable, best-effort outbox wakeup notifications and coalescing polling signals for faster same-process and distributed event processing.
  • Allow inbox and outbox background pollers to wake immediately when new work is available while retaining adaptive polling as a fallback.

Bug Fixes:

  • Prevent outbox processing spans from incorrectly extending or becoming children of originating business traces by representing causation as links on new root spans.

Enhancements:

  • Deduplicate outbox wakeup notifications per unit of work and keep notification failures or latency out of the commit path.

Tests:

  • Add coverage for wake signal behavior, wake-aware polling, outbox notification coordination, failure handling, deduplication, and trace isolation.

@yilmaztayfun yilmaztayfun self-assigned this Aug 31, 2026
@yilmaztayfun
yilmaztayfun requested review from a team August 31, 2026 07:12
@sourcery-ai

sourcery-ai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Reviewer's Guide

Version 1.0.38 reduces event-processing latency with wake-aware inbox/outbox polling and an optional post-commit Dapr outbox nudge, while refining outbox telemetry to isolate worker publication traces and retain causation through links.

Sequence diagram for post-commit outbox wakeup

sequenceDiagram
    participant UOW as UnitOfWork
    participant Store as EfCoreOutboxStore
    participant Coordinator as OutboxWakeupCoordinator
    participant Notifier as DaprOutboxWakeupNotifier
    participant Dapr as DaprPubSub
    participant Poller as OutboxBackgroundService
    participant Processor as OutboxProcessor

    UOW->>Store: StoreAsync
    Store->>Coordinator: OnOutboxMessageStored
    Coordinator->>UOW: OnCompleted
    UOW->>Coordinator: CommitAsync completes
    Coordinator-)Notifier: NotifyAsync
    Notifier-)Dapr: PublishEventAsync
    Dapr-)Poller: OutboxWakeupEvent
    Poller->>Poller: WaitAsync returns early
    Poller->>Processor: ProcessOutboxMessagesAsync
Loading

Sequence diagram for wake-aware inbox delivery

sequenceDiagram
    participant Endpoint as EventsController
    participant UOW as UnitOfWork
    participant Signal as InboxWakeSignal
    participant Poller as InboxBackgroundService
    participant Processor as InboxProcessor

    Endpoint->>UOW: CommitAsync
    Endpoint->>Signal: Signal
    Signal-->>Poller: WaitAsync returns early
    Poller->>Processor: ProcessInboxMessagesAsync
Loading

Sequence diagram for isolated outbox publication tracing

sequenceDiagram
    participant Poller as OutboxProcessor
    participant Activity as Outbox.Process span
    participant Origin as Origin transition trace
    participant EventBus as EventBus

    Poller->>Poller: TryParseOrigin
    Poller->>Activity: StartActivity
    Activity-->>Origin: causation link
    Activity-->>Poller: worker publication episode
    Poller->>EventBus: PublishEnvelopeAsync
    EventBus-->>Activity: publish result
Loading

File-Level Changes

Change Details Files
Adds coalescing, DI-backed wake signals to make inbox and outbox polling react immediately while retaining adaptive polling as a fallback.
  • Introduces a bounded semaphore-based generic wake signal.
  • Makes both background services interrupt startup and retry/idle delays when signaled.
  • Signals the inbox loop after the delivery endpoint commits.
  • Registers independent inbox and outbox signals in the service collection.
framework/src/BBT.Aether.Core/BBT/Aether/Polling/IPollingWakeSignal.cs
framework/src/BBT.Aether.Core/BBT/Aether/Polling/PollingWakeSignal.cs
framework/src/BBT.Aether.AspNetCore/BBT/Aether/AspNetCore/Events/EventsController.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/Processing/InboxBackgroundService.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/Processing/OutboxBackgroundService.cs
framework/src/BBT.Aether.Infrastructure/Microsoft/Extensions/DependencyInjection/AetherOutboxServiceCollectionExtensions.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/Processing/OutboxProcessor.cs
framework/test/BBT.Aether.Infrastructure.Tests/Polling/PollingWakeSignalTests.cs
framework/test/BBT.Aether.Infrastructure.Tests/Polling/WakeAwarePollingTests.cs
Adds an optional post-commit outbox wakeup pipeline that publishes a best-effort pub/sub nudge without placing it on the outbox.
  • Adds the wakeup event, notifier abstraction, and Dapr notifier implementation.
  • Adds an options flag to enable wakeup signaling.
  • Tracks stored messages per shared UoW root and registers one detached, bounded-time notification after successful commit.
  • Handles missing ambient UoWs, notifier failures, and trace-context isolation while relying on polling for recovery.
framework/src/BBT.Aether.Core/BBT/Aether/Events/AetherOutboxOptions.cs
framework/src/BBT.Aether.Core/BBT/Aether/Events/IOutboxWakeupNotifier.cs
framework/src/BBT.Aether.Core/BBT/Aether/Events/OutboxWakeupEvent.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/DaprOutboxWakeupNotifier.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/EfCoreOutboxStore.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/OutboxWakeupCoordinator.cs
framework/test/BBT.Aether.Infrastructure.Tests/Polling/OutboxWakeupCoordinatorTests.cs
Changes outbox processing telemetry to represent worker publication as a new trace root with causation links instead of a parent-child continuation.
  • Clears ambient activity while creating each publish span to force root semantics.
  • Links the stored origin context and polling-loop context when available.
  • Preserves event/message tags and records publish failures under the new span model.
  • Updates coverage for origin, worker-loop, malformed, and absent trace contexts.
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/Processing/OutboxProcessor.cs
framework/test/BBT.Aether.Infrastructure.Tests/BBT/Aether/Events/Processing/OutboxProcessorTraceTests.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 41a5f592-7a5f-4460-8aa1-f2e737fd65f9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yilmaztayfun
yilmaztayfun merged commit 391297f into release-v1.0 Aug 31, 2026
2 of 5 checks passed

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/DaprOutboxWakeupNotifier.cs" line_range="11-23" />
<code_context>
+/// Publishes <see cref="OutboxWakeupEvent"/> straight to the configured pub/sub component,
+/// bypassing the outbox by design (the nudge must not create the work it announces).
+/// </summary>
+public sealed class DaprOutboxWakeupNotifier(
+    DaprClient daprClient,
+    ITopicNameStrategy topicNameStrategy,
+    AetherEventBusOptions eventBusOptions) : IOutboxWakeupNotifier
+{
+    private readonly string _topic = topicNameStrategy.GetTopicName(typeof(OutboxWakeupEvent));
+
+    public Task NotifyAsync(CancellationToken cancellationToken = default)
+        => daprClient.PublishEventAsync(
+            eventBusOptions.PubSubName,
+            _topic,
+            new OutboxWakeupEvent(),
+            cancellationToken);
+}
</code_context>
<issue_to_address>
**issue (broader_impact):** The notifier publishes OutboxWakeupEvent, but the framework registers no handler, subscription endpoint, or callback that converts that event into IPollingWakeSignal<IOutboxProcessor>. Consequently, the outbox background service is never woken by the published nudge and continues waiting for its normal polling interval.

**Triggers:** When outbox wakeup is enabled and the outbox processor is expected to run in another process or receive the Dapr pub/sub nudge.

**Suggested fix:** Register a subscription/handler for OutboxWakeupEvent that resolves IPollingWakeSignal<IOutboxProcessor> and calls Signal(), or provide an equivalent Dapr delivery endpoint.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: framework/src/BBT.Aether.Infrastructure/BBT/Aether/Events/DaprOutboxWakeupNotifier.cs:23


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +11 to +23
public sealed class DaprOutboxWakeupNotifier(
DaprClient daprClient,
ITopicNameStrategy topicNameStrategy,
AetherEventBusOptions eventBusOptions) : IOutboxWakeupNotifier
{
private readonly string _topic = topicNameStrategy.GetTopicName(typeof(OutboxWakeupEvent));

public Task NotifyAsync(CancellationToken cancellationToken = default)
=> daprClient.PublishEventAsync(
eventBusOptions.PubSubName,
_topic,
new OutboxWakeupEvent(),
cancellationToken);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (broader_impact): The notifier publishes OutboxWakeupEvent, but the framework registers no handler, subscription endpoint, or callback that converts that event into IPollingWakeSignal. Consequently, the outbox background service is never woken by the published nudge and continues waiting for its normal polling interval.

Triggers: When outbox wakeup is enabled and the outbox processor is expected to run in another process or receive the Dapr pub/sub nudge.

Suggested fix: Register a subscription/handler for OutboxWakeupEvent that resolves IPollingWakeSignal and calls Signal(), or provide an equivalent Dapr delivery endpoint.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 19 duplication

Metric Results
Duplication 19

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant