Use DataBus if only a few messages are large?

Its really smart to reevaluate the need for databus when switching transport. You are right that it might not be needed for some transports but there are also other alternatives.

This information is listed at:

  • Use a different transport or different tier (e.g. Azure Service Bus Premium instead of Standard).
  • Use message body compression, which works well on text-based payloads like XML and JSON or any payload (text or binary) that contains repetitive data.
  • Use stream-based properties.
  • Use a more efficient serializer, such as a binary serializer.
  • Use NServiceBus.Attachments for unbounded binary payloads. The package is similar to the Data Bus but has some differences:
    • Read on demand: Attachments are only retrieved when read by a consumer.
    • Async enumeration: The package supports processing all data items using an IAsyncEnumerable.
    • No serialization: The serializer is not used, which may result in a significant reduction in memory usage.
    • Direct stream access: This makes the package more suitable for binary large objects (BLOBs since stream contents do not necessarily have to be loaded into memory before storing them or when retrieving them.

Let us know if you have any questions!

– Ramon

2 Likes