Skip to content

Commit 767e2d0

Browse files
committed
fix: update stale x-delay comment to reflect current Int32 cast
1 parent e9b9907 commit 767e2d0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/Foundatio.RabbitMQ/Messaging/RabbitMQMessageBus.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,8 @@ protected override async Task PublishImplAsync(string messageType, object messag
622622
// RabbitMQ only supports delayed messages with a third party plugin called "rabbitmq_delayed_message_exchange"
623623
if (_delayedExchangePluginEnabled is true && options.DeliveryDelay.HasValue && options.DeliveryDelay.Value > TimeSpan.Zero)
624624
{
625-
// It's necessary to typecast long to int because RabbitMQ on the consumer side is reading the
626-
// data back as signed (using BinaryReader#ReadInt64). You will see the value to be negative
627-
// and the data will be delivered immediately.
625+
// RabbitMQ's x-delay header must be a 32-bit signed int; the broker reads it as Int32
626+
// and negative values cause immediate delivery.
628627
basicProperties.Headers ??= new Dictionary<string, object?>();
629628
double delayMs = options.DeliveryDelay.Value.TotalMilliseconds;
630629
if (delayMs > Int32.MaxValue)

0 commit comments

Comments
 (0)