If you need to have a task performed you send
- A command message goes to only one endpoint that processes the message by interacting with your domain.
- If you need to have the command message performed from outside your application space such as from another application or across the Internet from a thrid-party then expose some integration layer that sends the message on your side.
When something interesting happens in your domain / application that another system may be interested in the publish
- There may be anything from no subscribers to N subscribers.
You get queued messages so that your system is not overwhelmed by a sudden burst of messages.
You also get automatic retries should the processing of a message fail.
Once you start using a service bus you will wonder why you ever worked without one.