Skip to content

v1.0.21#57

Merged
yilmaztayfun merged 6 commits into
release-v1.0from
master
Apr 12, 2026
Merged

v1.0.21#57
yilmaztayfun merged 6 commits into
release-v1.0from
master

Conversation

@yilmaztayfun
Copy link
Copy Markdown
Contributor

@yilmaztayfun yilmaztayfun commented Apr 12, 2026

Summary by Sourcery

Improve background job idempotency and time handling while hardening domain event outbox publishing.

Bug Fixes:

  • Skip reprocessing jobs that are already in Failed state to ensure idempotent handlers.
  • Ensure lookups by job name only consider active (Scheduled or Running) jobs, aligning behavior across job store and execution bridge.

Enhancements:

  • Normalize DateTime and DateTimeOffset persistence through clock-based value converters configurable at DbContext/model level.
  • Allow overwriting existing Dapr-scheduled jobs when re-scheduling by name.
  • Relax unit-of-work aspect auto-application by disabling the application service marker interface mapping.
  • Log and tolerate failures when publishing domain events to the outbox so remaining events continue processing.

Chores:

  • Remove repository ownership and automated review configuration files no longer needed.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added IsActive property to background jobs for status checking
    • Enhanced UTC datetime normalization for consistent timestamp handling
  • Bug Fixes

    • Fixed job scheduling to properly support job overwriting
    • Failed jobs are now treated as terminal states and won't be reprocessed
    • Improved active job retrieval logic
    • Enhanced event publishing with error recovery to prevent dispatch failures
  • Chores

    • Removed configuration files

middt and others added 6 commits March 24, 2026 11:09
…rter and guard job re-dispatch by status

Scope 1 — EF Core DateTime read normalization (closes #55 scope 1):
- Add ClockDateTimeValueConverter and ClockDateTimeOffsetValueConverter,
  both backed by IClock.NormalizeToUtc, covering DateTime, DateTime?,
  DateTimeOffset, and DateTimeOffset? via EF Core null-lifting.
- Inject optional IClock into AetherDbContext<TDbContext> primary constructor
  so the model-building pipeline can access the clock without breaking
  existing derived DbContextes.
- Thread IClock through ConfigureByConvention → TryConfigureDateTimeUtc and
  apply the appropriate converter to every DateTime/DateTimeOffset property
  at model build time, ensuring consistent UTC Kind/Offset on both read and
  write paths for all entities.

Scope 2 — DaprJobExecutionBridge status-aware dispatch guard (closes #55 scope 2):
- Add IJobStore.GetByJobNameAsync(string, BackgroundJobStatus?, CancellationToken)
  overload; nulls preserves existing no-filter semantics.
- Implement the overload in EfCoreJobStore with a conditional Where clause.
- Update DaprJobExecutionBridge to query only Scheduled jobs; log a warning
  and return early when the job is not found in the expected state, preventing
  re-dispatch of already completed, failed, or cancelled jobs.
…ency

- Remove overloaded  and consolidate
  active-job filtering (Scheduled | Running) into the single
   method; introduce  computed
  property on
- Change  to look up existing jobs by
  instead of uid=502(U0B006) gid=20(staff) groups=20(staff),501(awagent),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),701(com.apple.sharepoint.group.1),702(com.apple.sharepoint.group.2),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae), enabling upsert-by-name semantics
- Add  status to idempotency check in  so
  previously-failed jobs are not reprocessed
- Pass  when scheduling Dapr jobs to allow
  rescheduling without conflicts
- Comment out  marker in
  to prevent automatic UoW wrapping on all application services
…erter-for-iclock-normalization-daprjobexecutionbridge-status-aware-lookup

fix(background-jobs): normalize DateTime via EF Core ValueConverter and simplify job store API
@yilmaztayfun yilmaztayfun self-assigned this Apr 12, 2026
@yilmaztayfun yilmaztayfun requested review from a team April 12, 2026 20:42
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 12, 2026

Reviewer's Guide

This PR refines background job idempotency and activity tracking, hardens domain event outbox publishing, and introduces clock-based DateTime normalization in EF Core while wiring clock usage through the base DbContext; it also relaxes the UoW aspect’s automatic application and removes repo meta files.

Sequence diagram for Dapr-based background job scheduling and idempotent execution

sequenceDiagram
actor ExternalScheduler
participant DaprJobScheduler
participant DaprJobsClient
participant DaprJobExecutionBridge
participant IJobStore
participant JobDispatcher
participant JobHandler

ExternalScheduler->>DaprJobScheduler: ScheduleAsync(jobName, schedule, payload)
DaprJobScheduler->>DaprJobsClient: ScheduleJobAsync(jobName, schedule, payload, overwrite=true)
DaprJobsClient-->>DaprJobScheduler: scheduled

ExternalScheduler->>DaprJobExecutionBridge: ExecuteAsync(jobName, payload)
DaprJobExecutionBridge->>IJobStore: GetByJobNameAsync(jobName)
IJobStore-->>DaprJobExecutionBridge: BackgroundJobInfo or null (only IsActive)

alt job not found or not active
  DaprJobExecutionBridge->>DaprJobExecutionBridge: LogWarning(Job not found in Scheduled state)
  DaprJobExecutionBridge-->>ExternalScheduler: return
else active job found
  DaprJobExecutionBridge->>JobDispatcher: DispatchAsync(jobInfo)
  JobDispatcher->>JobDispatcher: IsJobAlreadyProcessed(jobInfo, jobId, handlerName)
  alt Status is Completed or Cancelled or Failed
    JobDispatcher->>JobDispatcher: LogWarning(Skipping reprocessing)
    JobDispatcher-->>DaprJobExecutionBridge: return
  else Status is Scheduled or Running
    JobDispatcher->>JobHandler: Handle(jobInfo.Payload)
    JobHandler-->>JobDispatcher: completed
    JobDispatcher-->>DaprJobExecutionBridge: return
  end
  DaprJobExecutionBridge-->>ExternalScheduler: return
end
Loading

Sequence diagram for domain event outbox publishing with error handling

sequenceDiagram
participant AetherDbContext
participant DomainEventDispatcher
participant EventBus
participant Logger

AetherDbContext->>DomainEventDispatcher: DispatchEventsAsync(eventEnvelopes)
loop for each eventEnvelope
  DomainEventDispatcher->>Logger: LogDebug(Writing domain event to outbox)
  DomainEventDispatcher->>EventBus: PublishAsync(event, metadata, subject, useOutbox=true)
  alt publish succeeds
    EventBus-->>DomainEventDispatcher: completed
    DomainEventDispatcher->>Logger: LogDebug(Successfully wrote domain event to outbox)
  else publish throws
    EventBus--xDomainEventDispatcher: Exception
    DomainEventDispatcher->>Logger: LogError(exception, Failed to publish domain event to outbox, continue)
    DomainEventDispatcher->>DomainEventDispatcher: Proceed to next event
  end
end
Loading

Class diagram for EF Core clock-based DateTime normalization

classDiagram
class AetherDbContext_TDbContext {
  +AetherDbContext_TDbContext(DbContextOptions_TDbContext options, IDomainEventSink eventSink, IClock clock)
  -IDomainEventSink eventSink
  -IClock clock
  +OnModelCreating(ModelBuilder modelBuilder)
  +ConfigureBaseProperties_TEntity(ModelBuilder modelBuilder)
}

class AetherEntityTypeBuilderExtensions {
  +static ConfigureByConvention(EntityTypeBuilder builder, IClock clock)
  +static TryConfigureDateTimeUtc(EntityTypeBuilder builder, IClock clock)
}

class ClockDateTimeValueConverter {
  +ClockDateTimeValueConverter(IClock clock)
}

class ClockDateTimeOffsetValueConverter {
  +ClockDateTimeOffsetValueConverter(IClock clock)
}

class IClock {
  +NormalizeToUtc_DateTime(DateTime value) DateTime
  +NormalizeToUtc_DateTimeOffset(DateTimeOffset value) DateTimeOffset
}

class ValueConverter_DateTime_DateTime
class ValueConverter_DateTimeOffset_DateTimeOffset

AetherDbContext_TDbContext ..> IClock
AetherDbContext_TDbContext ..> IDomainEventSink
AetherDbContext_TDbContext ..> AetherEntityTypeBuilderExtensions

AetherEntityTypeBuilderExtensions ..> ClockDateTimeValueConverter
AetherEntityTypeBuilderExtensions ..> ClockDateTimeOffsetValueConverter

ClockDateTimeValueConverter --|> ValueConverter_DateTime_DateTime
ClockDateTimeOffsetValueConverter --|> ValueConverter_DateTimeOffset_DateTimeOffset

ClockDateTimeValueConverter ..> IClock
ClockDateTimeOffsetValueConverter ..> IClock
Loading

File-Level Changes

Change Details Files
Harden domain event outbox publishing so failures on a single event do not break the entire dispatch loop.
  • Wrap outbox PublishAsync call in a try/catch when useOutboxDirectly is true.
  • Log a debug message before publishing and on success, and log an error with the exception if publishing fails, while continuing with remaining events.
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/DomainEventDispatcher.cs
Change background job persistence and lookup semantics to operate on active jobs by name and tune idempotency behavior.
  • Use GetByJobNameAsync instead of querying by Id in SaveAsync, updating existing jobs with matching jobName while keeping ModifiedAt in UTC.
  • Make GetByJobNameAsync return only jobs in Scheduled or Running status, aligning with the notion of active jobs.
  • Ensure ModifiedAt is consistently updated in UpdateStatusAsync and rely on the surrounding UoW for SaveChanges.
  • Expose a convenience IsActive property on BackgroundJobInfo for Scheduled or Running states.
  • Clarify IJobStore.GetByJobNameAsync documentation to indicate it returns active jobs only.
framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/EfCoreJobStore.cs
framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Entities/BackgroundJobInfo.cs
framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Repositories/IJobStore.cs
Make job execution idempotent across Completed, Cancelled, and Failed jobs and adjust scheduler/bridge behavior.
  • Extend IsJobAlreadyProcessed to treat Failed status as already processed, logging a warning and skipping reprocessing.
  • Change DaprJobExecutionBridge logging when a job is not found to a warning that the job may already be processed or cancelled.
  • Configure the DaprJobScheduler to schedule jobs with overwrite=true so rescheduling replaces an existing Dapr job for the same name.
framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/JobDispatcher.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/Dapr/DaprJobExecutionBridge.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/Dapr/DaprJobScheduler.cs
Introduce clock-based DateTime normalization in EF Core mappings and wire it through the base DbContext.
  • Add ClockDateTimeValueConverter and ClockDateTimeOffsetValueConverter that use IClock.NormalizeToUtc on both read and write.
  • Update AetherEntityTypeBuilderExtensions.ConfigureByConvention and TryConfigureDateTimeUtc to accept an optional IClock and apply the appropriate clock-backed value converter for DateTime and DateTimeOffset properties while keeping column type as timestamp with time zone.
  • Inject an optional IClock into AetherDbContext and pass it into ConfigureByConvention when configuring base entity properties so all entities can benefit from normalized UTC handling.
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/Modeling/AetherEntityTypeBuilderExtensions.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/AetherDbContext.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/ValueComparers/ClockDateTimeOffsetValueConverter.cs
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/ValueComparers/ClockDateTimeValueConverter.cs
Adjust UoW aspect auto-application markers and remove repository meta/config files from the codebase.
  • Comment out the IApplicationService marker interface name in UnitOfWorkAspectProvider, effectively disabling automatic UoW aspects for that interface.
  • Delete .coderabbit.yaml and .github/CODEOWNERS to drop repository-level code review and ownership configuration from this project snapshot.
framework/src/BBT.Aether.Aspects/BBT/Aether/Aspects/Uow/UnitOfWorkAspectProvider.cs
.coderabbit.yaml
.github/CODEOWNERS

Possibly linked issues

  • #unknown: PR adds IClock-based DateTime converters and restricts job lookups to active statuses, matching both scopes of the issue.

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
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

Caution

Review failed

The pull request is closed.

Warning

Ignoring CodeRabbit configuration file changes. For security, only the configuration from the base branch is applied for open source repositories.

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'review'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e71fe250-9b14-4815-b6bb-968e8b751170

📥 Commits

Reviewing files that changed from the base of the PR and between 3960f59 and 8ab8f8e.

📒 Files selected for processing (14)
  • .coderabbit.yaml
  • .github/CODEOWNERS
  • framework/src/BBT.Aether.Aspects/BBT/Aether/Aspects/Uow/UnitOfWorkAspectProvider.cs
  • framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Entities/BackgroundJobInfo.cs
  • framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Repositories/IJobStore.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/Dapr/DaprJobExecutionBridge.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/Dapr/DaprJobScheduler.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/EfCoreJobStore.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/JobDispatcher.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/AetherDbContext.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/DomainEventDispatcher.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/Modeling/AetherEntityTypeBuilderExtensions.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/ValueComparers/ClockDateTimeOffsetValueConverter.cs
  • framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/ValueComparers/ClockDateTimeValueConverter.cs

📝 Walkthrough

Walkthrough

This PR removes configuration files, adds a computed IsActive property to background jobs, improves background job status handling and error logging, introduces clock-based DateTime normalization to EF Core infrastructure via new value converters, and enhances event dispatch error handling.

Changes

Cohort / File(s) Summary
Configuration Removal
.coderabbit.yaml, .github/CODEOWNERS
Deleted repository configuration files and code ownership mappings.
Domain Model Enhancements
framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Entities/BackgroundJobInfo.cs, framework/src/BBT.Aether.Domain/BBT/Aether/Domain/Repositories/IJobStore.cs
Added IsActive computed property to BackgroundJobInfo and clarified IJobStore documentation for active job retrieval.
Background Job Infrastructure
framework/src/BBT.Aether.Infrastructure/BBT/Aether/BackgroundJob/...
Updated job status handling: EfCoreJobStore now queries by job name with status filtering; DaprJobScheduler enables overwrite mode; DaprJobExecutionBridge improves logging when jobs not found; JobDispatcher treats Failed as terminal state; UnitOfWorkAspectProvider empties default marker interface list.
Event Dispatching
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/DomainEventDispatcher.cs
Added try/catch wrapping to the outbox publish path to catch and log errors while continuing dispatch.
EF Core DateTime Normalization
framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/AetherDbContext.cs, framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/Modeling/AetherEntityTypeBuilderExtensions.cs, framework/src/BBT.Aether.Infrastructure/BBT/Aether/Domain/EntityFrameworkCore/ValueComparers/ClockDateTime...Converter.cs
Added optional IClock parameter to AetherDbContext constructor and EF Core extension methods; introduced ClockDateTimeValueConverter and ClockDateTimeOffsetValueConverter for UTC normalization of temporal properties.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • middt
  • ukaratas
  • safakcakir

Poem

🐰 A clockwork garden of jobs takes flight,
With failed states marked and active states bright,
DateTime converters in UTC we trust,
Normalizing moments from dust unto dust!
The dispatcher catches and logs with great care,
While schedules and handlers skip nimbly through air. ⏰

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch master

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 and usage tips.

@yilmaztayfun yilmaztayfun merged commit 71684b8 into release-v1.0 Apr 12, 2026
3 of 5 checks passed
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In DomainEventDispatcher, the broad catch (Exception) around PublishAsync logs and swallows failures while continuing the loop, which may make it hard to detect partial outbox write failures; consider surfacing these errors (e.g., via an aggregate exception, callback, or result object) or making the 'continue on failure' behavior explicitly configurable.
  • Changing EfCoreJobStore.SaveAsync to detect existing jobs by GetByJobNameAsync (which now only returns Scheduled/Running) means jobs with the same JobName in a Completed/Cancelled/Failed state will no longer be updated but instead create a new row; if that’s not intentional, consider either including inactive statuses in the lookup or documenting/enforcing job-name uniqueness per lifecycle explicitly.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `DomainEventDispatcher`, the broad `catch (Exception)` around `PublishAsync` logs and swallows failures while continuing the loop, which may make it hard to detect partial outbox write failures; consider surfacing these errors (e.g., via an aggregate exception, callback, or result object) or making the 'continue on failure' behavior explicitly configurable.
- Changing `EfCoreJobStore.SaveAsync` to detect existing jobs by `GetByJobNameAsync` (which now only returns Scheduled/Running) means jobs with the same `JobName` in a Completed/Cancelled/Failed state will no longer be updated but instead create a new row; if that’s not intentional, consider either including inactive statuses in the lookup or documenting/enforcing job-name uniqueness per lifecycle explicitly.

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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the CodeRabbit and CODEOWNERS configuration files and integrates IClock into the EF Core infrastructure to ensure consistent UTC normalization for DateTime and DateTimeOffset properties via new value converters. Background job management is updated with an IsActive property, expanded idempotency checks to include failed states, and Dapr scheduling overrides. Critical feedback highlights a potential unique constraint violation in EfCoreJobStore due to status-filtered lookups during save operations, the risk of silent data loss from swallowing exceptions in the DomainEventDispatcher, and the need to remove commented-out code in the UnitOfWorkAspectProvider.

// Check if job already exists
var existingJob = await _dbContext.BackgroundJobs
.FirstOrDefaultAsync(j => j.Id == jobInfo.Id, cancellationToken);
var existingJob = await GetByJobNameAsync(jobInfo.JobName, 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.

high

Using GetByJobNameAsync here is problematic because it now filters for only Scheduled or Running jobs. If a job with the same JobName already exists in a terminal state (e.g., Completed or Failed), existingJob will be null, and the code will attempt to AddAsync a new record. This will likely cause a unique constraint violation in the database or result in duplicate job entries. Use a lookup that does not filter by status for this existence check.

        var existingJob = await _dbContext.BackgroundJobs
            .FirstOrDefaultAsync(j => j.JobName == jobInfo.JobName, cancellationToken);

Comment on lines +38 to +54
try
{
logger.LogDebug("Writing domain event to outbox: {EventType} (Name: {EventName}, Version: {Version})",
metadata.EventType.Name, metadata.EventName, metadata.Version);

// Write directly to outbox within the transaction
await eventBus.PublishAsync(@event, metadata,
subject: EventSubjectExtractor.ExtractSubject(@event),
useOutbox: true, cancellationToken);
await eventBus.PublishAsync(@event, metadata,
subject: EventSubjectExtractor.ExtractSubject(@event),
useOutbox: true, cancellationToken);

logger.LogDebug("Successfully wrote domain event to outbox: {EventType}", metadata.EventType.Name);
logger.LogDebug("Successfully wrote domain event to outbox: {EventType}", metadata.EventType.Name);
}
catch (Exception ex)
{
logger.LogError(ex,
"Failed to publish domain event to outbox: {EventType}. Continuing with remaining events",
metadata.EventType.Name);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Swallowing exceptions when publishing to the outbox can lead to silent data loss. When useOutboxDirectly is enabled, the event publication is typically a critical part of the transaction. If the outbox write fails, the entire operation should fail and roll back to ensure consistency. Exceptions should be allowed to propagate.

                logger.LogDebug("Writing domain event to outbox: {EventType} (Name: {EventName}, Version: {Version})",
                    metadata.EventType.Name, metadata.EventName, metadata.Version);

                await eventBus.PublishAsync(@event, metadata, 
                    subject: EventSubjectExtractor.ExtractSubject(@event),
                    useOutbox: true, cancellationToken);

                logger.LogDebug("Successfully wrote domain event to outbox: {EventType}", metadata.EventType.Name);

private readonly static HashSet<string> MarkerInterfaceNames = new()
{
"BBT.Aether.Application.IApplicationService"
//"BBT.Aether.Application.IApplicationService"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Commented-out code should be removed to maintain code cleanliness. If this marker interface is no longer intended for automatic Unit of Work application, the entry should be deleted entirely.

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@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.

2 participants