/// <summary>Initiate plugin for Receive-Only mode to retrieve attachments using SAS URI. </summary> /// <param name="client"><see cref="IClientEntity"/>, <see cref="SubscriptionClient"/>, <see cref="QueueClient"/>, <see cref="MessageSender"/>, <see cref="MessageReceiver"/>, or <see cref="SessionClient"/> to register plugin with.</param> /// <param name="messagePropertyToIdentifySasUri">Message property name to be used to retrieve message SAS UI.</param> /// <returns>Registered plugin as <see cref="ServiceBusPlugin"/>.</returns> public static ServiceBusPlugin RegisterAzureStorageAttachmentPluginForReceivingOnly(this IClientEntity client, string messagePropertyToIdentifySasUri = AzureStorageAttachmentConfigurationExtensions.DefaultMessagePropertyToIdentitySasUri) { var plugin = new ReceiveOnlyAzureStorageAttachment(messagePropertyToIdentifySasUri); client.RegisterPlugin(plugin); return(plugin); }
/// <summary>Download attachment from Azure Storage blob without registering plugin, using message property to identify SAS URI.</summary> /// <param name="message"><see cref="Message"/></param> /// <param name="messagePropertyToIdentifySasUri">Message property which contains the SAS URI used to fetch message body from blob.</param> /// <returns><see cref="Message"/> with body downloaded from Azure Storage blob.</returns> public static async Task <Message> DownloadAzureStorageAttachment(this Message message, string messagePropertyToIdentifySasUri = AzureStorageAttachmentConfigurationConstants.DefaultMessagePropertyToIdentitySasUri) { var plugin = new ReceiveOnlyAzureStorageAttachment(messagePropertyToIdentifySasUri); return(await plugin.AfterMessageReceive(message).ConfigureAwait(false)); }