Skip to content

Latest commit

 

History

History
135 lines (72 loc) · 5.18 KB

README.source.md

File metadata and controls

135 lines (72 loc) · 5.18 KB

Icon

Allows sending messages that exceed maximum size by implementing Claim Check pattern with Azure Storage.

license develop opened issues

Nuget package

NuGet Status

Available here http://nuget.org/packages/ServiceBus.AttachmentPlugin

To Install from the Nuget Package Manager Console

PM> Install-Package ServiceBus.AttachmentPlugin

toc

Examples

Convert body into attachment, no matter how big it is

Configuration and registration

snippet: ConfigurationAndRegistration

Sending

snippet: AttachmentSending

Receiving

snippet: AttachmentReceiving

Sending a message without exposing the storage account to receivers

Configuration and registration with blob SAS URI

snippet: ConfigurationAndRegistrationSas

Sending

snippet: AttachmentSendingSas

Receiving only mode (w/o Storage account credentials)

snippet: AttachmentReceivingSas

Configure blob container name

Default container name is "attachments". The value is available via AzureStorageAttachmentConfigurationConstants.DefaultContainerName constant.

new AzureStorageAttachmentConfiguration(storageConnectionString, containerName:"blobs");

Configure message property to identify attachment blob

Default blob identifier property name is "$attachment.blob". The value is available via AzureStorageAttachmentConfigurationConstants.DefaultMessagePropertyToIdentifyAttachmentBlob constant.

new AzureStorageAttachmentConfiguration(storageConnectionString, messagePropertyToIdentifyAttachmentBlob: "myblob");

Configure custom blob name override

Default blob name is a GUID.

snippet: Configure_blob_name_override

Configure message property for SAS uri to attachment blob

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

Configure criteria for message max size identification

Default is to convert any body to attachment.

snippet: Configure_criteria_for_message_max_size_identification

Configuring connection string provider

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

Configuring plugin using StorageCredentials (Service or Container SAS)

snippet: Configuring_plugin_using_StorageCredentials

See StorageCredentials for more details.

Using attachments with Azure Functions

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

Additional providers

Cleanup

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.

Who's trusting this plugin in production

Microsoft Codit Hemonto

Proudly list your company here if use this plugin in production

Icon

Created by Dinosoft Labs from the Noun Project.