Fixed body corruption in Tapeti.Cmd shovel command
This commit is contained in:
parent
51ebfd62b4
commit
2eb66c5780
@ -22,10 +22,14 @@ namespace Tapeti.Cmd.Commands
|
|||||||
// No more messages on the queue
|
// No more messages on the queue
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Since RabbitMQ client 6 we need to copy the body before calling another channel method
|
||||||
|
// like BasicPublish, or the published body will be corrupted
|
||||||
|
var bodyCopy = result.Body.ToArray();
|
||||||
|
|
||||||
|
|
||||||
rateLimiter.Execute(() =>
|
rateLimiter.Execute(() =>
|
||||||
{
|
{
|
||||||
targetChannel.BasicPublish("", TargetQueueName, result.BasicProperties, result.Body);
|
targetChannel.BasicPublish("", TargetQueueName, result.BasicProperties, bodyCopy);
|
||||||
messageCount++;
|
messageCount++;
|
||||||
|
|
||||||
if (RemoveMessages)
|
if (RemoveMessages)
|
||||||
|
Loading…
Reference in New Issue
Block a user