.net - Grouping published events in NServiceBus -


i'm using nservicebus send orders (one order per command) back-end systems. each order has customer (parent). back-end system publishes "order accepted" event after order saved successfully. there multiple subscribers event 1 of them file generator component generates xml file consumed third party. file generated per customer. since published event @ order level every time "order accepted" event published file component creates entire file customer.

is there way within nservicebus group events @ subscriber can reduce number of times file generator runs if there multiple orders same customer?

one idea had put subscriber sleep fixed time , when wakes can group messages in queue customer , generate file once per customer. sound idea?

thanks in advance.

the best way use saga behavior of debouncer.

the saga subscribe event, , every time observed, request new timeout period of time willing wait, let's 5 minutes.

if timeout message arrives , there have been no additional events observed since set, can send command run file generator.

this makes assumption incoming events going arrive in spurts, is, you'll receive grouping of them close , none quite time. using debouncer this, if received 1 event per minute forever, file generator never executed.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -