Skip to content

Introduce Configurable Interval for Outbox Forwarder #111

@jeroenkoknl

Description

@jeroenkoknl

Currently, the interval for forwarding messages from the outbox table to the bus transport is hardcoded to 1 second:

_forwarder = asyncTaskFactory.Create("OutboxForwarder", RunForwarder, intervalSeconds: 1);

To make this more flexible for users of the outbox feature, I propose introducing configuration options that will allow the interval to be adjusted. My plan is as follows:

  • A new class, OutboxOptions, will be introduced. Initially, this class will contain one setting:

    • int ForwarderIntervalSeconds – defaulting to 1, cannot be less than 1 second.
  • The method SqlServerOutboxConfigurationExtensions.Outbox will receive a new overload:

    public static RebusConfigurer Outbox(this RebusConfigurer configurer, Action<StandardConfigurer<IOutboxStorage>> configure, OutboxOptions options)
    • This options parameter will be non-nullable.
    • The existing SqlServerOutboxConfigurationExtensions.Outbox method will call the new overload with default options. The implementation will move to the new overload.
  • The OutboxForwarder constructor will also receive an overload that accepts int forwarderIntervalSeconds. For backwards compatibility, the current constructor will remain and call the new constructor with the default value.

  • The sqlServerOutboxConfigurationExtensions.Outbox method will call the new OutboxForwarder constructor with the forwarderIntervalSeconds value from the OutboxOptions parameter.

This change will maintain backward compatibility since OutboxForwarder and its constructor are public.

Looking forward to your feedback on this proposal!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions