I'm using Rebus.Async
to send a request. Upon receipt, the consumer replies with a large amount of data, which it uploads to Azure Blob Storage using Rebus.AzureBlobs
.
The sender receives the reply and attempts to read the attachment. When this happens, Rebus throws an exception:
No message context is available - did you try to open a data bus attachment for reading OUTSIDE of a message handler?
Of course I'm intentionally opening the attachment outside a message handler because I'm using Rebus.Async
. However, it seems this isn't supported.
Is there a way to get data bus working with Rebus.Async
replies?
You should be able to simply pass along the attachment ID (the Id
property from the DataBusAttachment
returned from CreateAttachment
), which you can then
var dataBus = bus.Advanced.DataBus;
using (var source = await dataBus.OpenRead(attachmentId))
{
// do your thing :)
}