This is a plugin for Microsoft.Azure.ServiceBus client
Allows sending messages that exceed maximum size by implementing Claim Check pattern with Azure Storage.
Available here http://nuget.org/packages/ServiceBus.AttachmentPlugin
To Install from the Nuget Package Manager Console
PM> Install-Package ServiceBus.AttachmentPlugin
toc
Configuration and registration
snippet: ConfigurationAndRegistration
Sending
snippet: AttachmentSending
Receiving
snippet: AttachmentReceiving
Configuration and registration with blob SAS URI
snippet: ConfigurationAndRegistrationSas
Sending
snippet: AttachmentSendingSas
Receiving only mode (w/o Storage account credentials)
snippet: AttachmentReceivingSas
Default container name is "attachments". The value is available via AzureStorageAttachmentConfigurationConstants.DefaultContainerName
constant.
new AzureStorageAttachmentConfiguration(storageConnectionString, containerName:"blobs");
Default blob identifier property name is "$attachment.blob". The value is available via AzureStorageAttachmentConfigurationConstants.DefaultMessagePropertyToIdentifyAttachmentBlob
constant.
new AzureStorageAttachmentConfiguration(storageConnectionString, messagePropertyToIdentifyAttachmentBlob: "myblob");
Default blob name is a GUID.
snippet: Configure_blob_name_override
Default SAS uri property name is "$attachment.sas.uri". The value is available via AzureStorageAttachmentConfigurationConstants.DefaultMessagePropertyToIdentitySasUri
constant.
Default SAS token validation time is 7 days.
snippet: Configure_blob_sas_uri_override
Default is to convert any body to attachment.
snippet: Configure_criteria_for_message_max_size_identification
When Storage connection string needs to be retrieved rather than passed in as a plain text, AzureStorageAttachmentConfiguration
accepts implementation of IProvideStorageConnectionString
.
The plugin comes with a PlainTextConnectionStringProvider
and can be used in the following way.
snippet: Configuring_connection_string_provider
snippet: Configuring_plugin_using_StorageCredentials
See StorageCredentials
for more details.
Azure Functions currently has no way to register plugins, these extension methods are a workaround until this feature is added.
To use the extensions, your Function must return (send) or take as parameter (receive) an instance of Message
.
Upload attachment to Azure Storage blob
snippet: Upload_attachment_without_registering_plugin
Download attachment from Azure Storage blob
snippet: Download_attachment_without_registering_plugin
The plugin does NOT implement cleanup for the reasons stated here. When cleanup is required, there are a few options available depending on the use case.
Proudly list your company here if use this plugin in production
Created by Dinosoft Labs from the Noun Project.