Reputation: 89
In NServiceBus we have different message type like IMessage, ICommand, IEvent to communicate between system. What is the difference between IMessage, ICommand,IEvent? What business scenario we should use these types?
Thanks
Upvotes: 1
Views: 1205
Reputation: 101
As explained in the documentation:
Message
is the unit of communication for NServiceBus, there are two types of messages:
command
is used by one or more senders to ask for a specific action for a specific receiver. No broadcasting supported. event
is used by a single sender to notify many receivers that some action has taken place.Upvotes: 4
Reputation: 2345
Bear in mind that in SOA you have 4 message types:
As you might have already guessed, the IMessage is handy for Request-Reply scenario, which isn't a command or an event, but a hybrid "message" that behaves in non-standard way. Yet another useful scenarios are: audit trail, reporting progress, heartbeat, timeouts (saga or scheduled recurring tasks) etc. Consider these examples:
Upvotes: 2