The SqsMessageProducer only implements the IAmAMessageProducerSync interface, meaning it can only publish messages synchronously and has no async method.
Now that we can combine producer registries when configuring external buses, this means that if any SNS publications are included, then async methods cannot be used to clear the outbox. If they are, then an InvalidOperationException exception is thrown when trying to publish a message to SNS, and no further messages are published.
In practice, this means that:
IAmACommandProcessor.ClearOutboxAsync() cannot be used
When configuring the outbox, the UseBulk option cannot be set to true
These limitations are not obvious or straight forward for a user to understand, making them an easy rake to step on.
In this instance, my suggestion would be to implement the IAmAMessageProducerAsync interface in SqsMessageProducer (in fact, it already uses the async method from the AWS SDK, so this is easy to implement), allowing async methods to be used to clear the outbox.
Describe the bug
The SqsMessageProducer only implements the
IAmAMessageProducerSync
interface, meaning it can only publish messages synchronously and has noasync
method.Now that we can combine producer registries when configuring external buses, this means that if any SNS publications are included, then async methods cannot be used to clear the outbox. If they are, then an
InvalidOperationException
exception is thrown when trying to publish a message to SNS, and no further messages are published.In practice, this means that:
IAmACommandProcessor.ClearOutboxAsync()
cannot be usedUseBulk
option cannot be set totrue
These limitations are not obvious or straight forward for a user to understand, making them an easy rake to step on.
In this instance, my suggestion would be to implement the
IAmAMessageProducerAsync
interface inSqsMessageProducer
(in fact, it already uses theasync
method from the AWS SDK, so this is easy to implement), allowingasync
methods to be used to clear the outbox.Further technical details