What is difference between Message and Command

Just curious about knowing difference between NserviceBus Message and Command. I did not get any information from google yet.

Does this help?

1 Like

Thanks for sharing link. I am mostly using command and events so not finding much difference in Command and Message. My quick questions can Message be replaceable to Commands?

Hey @eraj2587,

are you referring to the ICommand and IMessage interfaces? In general we advise to use either commands or events as they are the most common types. Both IEvent and ICommand inherit from the IMessage interface, so this is just a little bit more generic. There are sometimes occasions where neither a command nor a event is the proper description for a message, e.g. when using timeout messages or when sending reply messages. In such cases you can mark these messages just as IMessage. In general you can use this guidance:

  • If you publish a message using the Publish API, it’s an event.
  • If you send a message using the Send API, it’s a command.
  • If you’re using a different API (e.g. Reply or RequestTimeout) it’s probably just a “message”.
2 Likes