An InvalidCastException is thrown when calling PostAsync with a DynamoDB outbox. However, it works correctly when calling DepositPostAsync while providing an IAmADynamoDbTransactionProvider
To Reproduce
Setup a DynamoDB outbox:
brighterBuilder.UseExternalBus((configure) =>
{
configure.ProducerRegistry = new KafkaProducerRegistryFactory(kafkaConfiguration, publications).Create();
configure.Outbox = new DynamoDbOutbox(dynamoDBClient, new DynamoDbConfiguration());
configure.TransactionProvider = typeof(DynamoDbUnitOfWork);
configure.ConnectionProvider = typeof(DynamoDbUnitOfWork);
});
System.InvalidCastException: Unable to cast object of type 'Paramore.Brighter.ExternalBusServices2[Paramore.Brighter.Message,Amazon.DynamoDBv2.Model.TransactWriteItemsRequest]' to type 'Paramore.Brighter.ExternalBusServices2[Paramore.Brighter.Message,System.Transactions.CommittableTransaction]'
Describe the bug
An InvalidCastException is thrown when calling PostAsync with a DynamoDB outbox. However, it works correctly when calling DepositPostAsync while providing an IAmADynamoDbTransactionProvider
To Reproduce
Setup a DynamoDB outbox:
Call PostAsync method
The failure occurs in CommandProcessor:![image](https://github.com/BrighterCommand/Brighter/assets/22519624/7e1119bf-64fd-4492-ba58-c12861c7ba16)
Link to original discussion: https://github.com/BrighterCommand/Brighter/discussions/3091
Exceptions (if any)
Further technical details