使用Rebus的数据总线found here时,有什么方法可以添加多个数据总线附件吗?假设我有两个不同的来源,我想发布。
我目前正在尝试:
private async void AddTwoDataBusAttachments(Stream firstSource, Stream secondSource, Message message)
{
using (firstSource)
{
var dataBusFirstAttachment = await _bus.Advanced
.DataBus
.CreateAttachment(source: firstSource)
.ConfigureAwait(false);
var dataBusSecondAttachment = await _bus.Advanced
.DataBus
.CreateAttachment(source: secondSource)
.ConfigureAwait(false);
await _bus.Publish(eventMessage: new NewMessage
{
DocumentIdentifier = message.DocumentIdentifier,
FirstAttachmentIdentifier = dataBusFirstAttachment.Id,
SecondAttachmentIdentifier = dataBusSecondAttachment.Id
})
.ConfigureAwait(continueOnCapturedContext: false);
}
}
但在创建dataBusSecondAttachment
时遇到错误:Rebus.Exceptions.RebusApplicationException: 'Could not save data with ID 0e9125a8-4c3a-4dec-8223-6925b8ae4d40'
答案 0 :(得分:0)
没有什么可以阻止您创建多个附件,因此我怀疑您的错误是由其他内容引起的。你能更新问题并发布完整的堆栈跟踪吗?