1

I am working on an enterprise system in which I want to replicate data from one bounded context (source) into another bc (destination). I definitely want to store the data in the destination bc, rather than fetch it when required as the volume of data is high.

I have reviewed many messaging patterns, but am struggling to decide between document message and message enrichment.

  1. Document message - when event occurs in source send the whole message to the destination via broadcast over service bus. Pros: simple, destination is decoupled from source. Cons: message size.

  2. Message enrichment - send message containing entity id and link back to the source data via broadcast over service bus. Pros: lite message. Cons: destination more coupled to source (although mitigated via link in payload), synchronous call required back to source to get the data.

Are there any other considerations I should be aware of here? I have read that large messages over service bus is a bad thing. But how big is bad?? And why is it that bad? There is a limit of 256kb per message on Azure Service Bus, but my messages would be maximum 1kb.

Any help would be greatly appreciated... Thanks.

user644698
  • 209
  • 2
  • 12
  • 1
    In this case it doesn't sound like the problem is Azure Service Bus if your messages are so small (1K). It's the architectural decision you'll have to make and live with it. For example, if system of origin would be a monolyth system that you want to break apart, I'd go with event based (document message) for example. BTW, maximum message size can be addressed with [claim check pattern](http://www.enterpriseintegrationpatterns.com/patterns/messaging/StoreInLibrary.html). A typical one would be using an [external storage](https://www.nuget.org/packages/servicebus.attachmentplugin). – Sean Feldman Nov 27 '17 at 19:35

1 Answers1

1

1 KB is definitely nothing big for Service Bus, so I think you are free to go with option 1.

As you say, the payload limit is 256 KB, but even if you want to send bigger messages - a common pattern is to put the payload into blob storage and then send a link via Service Bus. But for messages that fit - don't bother.

Note that the limit of 256 KB applies per batch, when you send many messages as a single operation. Still plenty of room for batching at 1 KB size.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107