Samples
The best way to get started is with the samples.
These samples include:
- Publish Subscribe
- Request Response
- Async Web Apps
Publish Subscribe
While the common term to describe this kind of communication is "pub/sub",
the subscribe action actually happens before the publish. Yet, before the subscribe
there is actually an additional action that needs to be understood - "advertise".
While NServiceBus isn't directly involved in the advertise action, this is something
that you, as a developer, need to be aware of. In this action, the publisher makes
known the schema of the messages that it will be publishing as well as the queue
on which it will be listening for subscription requests.
The publisher will likely have additional queues and processes.
Pub/Sub Configuration
Some way, outside of NServiceBus, the subscriber received the message schema from the
publisher. To the left you can see the resulting configuration of both publisher and
subscriber.
The part of the <add> entry stating Messages="Messages" means
that the assembly "Messages.dll" contains the message schema.
The part stating Endpoint="messagebus" is telling the subscriber's bus object
that the publisher will be accepting subscription requests on that queue.
The queue name "messagebus" is short for "the queue named 'messagebus' on the
local machine". To indicate a queue on a remote machine, you use a format similar to
email: MessageBus@RemoteServer. Input queues do need to be local, though.
If you haven't had the chance yet,
do spend some time and learn about
the architectural principles behind NServiceBus.