Skip to content

Conversation

@celia-moreno
Copy link
Contributor

This update enables compression when using AzureStorageMessageDataRepository for claim check.
Files will be compressed before being written to blob storage and saved as .gz files.

image

On the consumer side, there is no need to manually set the flag, as the system will automatically detect if the file in blob storage is a .gz file and decompress it accordingly.

Changes Summary:

Added a compression option to the AzureStorageMessageDataRepository class.
Updated relevant methods to support compression.
Modified configuration extensions to handle the new compression feature.

Additionally, the documentation has been updated to reflect the new flag when initializing the AzureStorageMessageDataRepository:
image

…laim check

Added a compression option to the AzureStorageMessageDataRepository class.
Updated relevant methods to support compression.
Modified configuration extensions to handle the new compression feature.
@vercel
Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
masstransit-documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 11:57am

Copy link
Member

@phatboyg phatboyg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can you clone this unit test to verify the compression works?

public class Sending_a_message_with_data :


return await blob.OpenReadAsync(new BlobOpenReadOptions(false), cancellationToken).ConfigureAwait(false);
var stream = await blob.OpenReadAsync(new BlobOpenReadOptions(false), cancellationToken).ConfigureAwait(false);
return blobName.EndsWith(".gz", StringComparison.OrdinalIgnoreCase) || _compress ? new GZipStream(stream, CompressionMode.Decompress, true) : stream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you're going to have some ownership/disposable issues with these streams to where they aren't closed and/or disposed properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, now when compressing I am setting the leaveOpen to false to dispose the stream after disposing the GZipStream object

if (_compress)
{
blobName += ".gz";
blob = _container.GetBlobClient(blobName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Determine the blob name before calling GetBlobClient, and only call it once (the call for the original filename is above).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done, take a look to last commit

@phatboyg
Copy link
Member

Also, the documentation for claim check (message data) is way out of date. You mentioned you updated the documentation, but I didn't see any updates in that area.

https://masstransit.io/documentation/patterns/claim-check#azure-storage

Adding unit tests to ensure compression is working.
Fix ownership/dispose of the stream once it is compressed
Avoid to create the BlobClient twice
@celia-moreno
Copy link
Contributor Author

Also, the documentation for claim check (message data) is way out of date. You mentioned you updated the documentation, but I didn't see any updates in that area.

https://masstransit.io/documentation/patterns/claim-check#azure-storage

I forgot to push my last commit, my bad, now it is updated

@celia-moreno celia-moreno requested a review from phatboyg January 9, 2025 13:39
@phatboyg phatboyg merged commit 99eb142 into MassTransit:develop Jan 9, 2025
2 checks passed
@celia-moreno celia-moreno deleted the cmo/Enable_compression_azure_storage_message_data_repository branch March 27, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants