Book Image

Learning NServiceBus - Second Edition

By : David Boike
Book Image

Learning NServiceBus - Second Edition

By: David Boike

Overview of this book

Table of Contents (18 chapters)
Learning NServiceBus Second Edition
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Message routing


Now that we've spoken about commands and events, it's a good time to discuss how NServiceBus routes messages. Message routing is handled completely by configuration, within the UnicastBusConfig section that we have seen only a bit of so far. By storing the mappings in the configuration allows us to test our system entirely on one machine, and then modify the configuration for a production scenario that uses multiple machines for processing.

Messages are routed by type, and the UnicastBusConfig section maps message types to the queues and machines that must process them. When defining types, we may specify an entire assembly name, which is what we have done so far. In that case, all messages within that assembly are associated with the same endpoint. We may also specify particular message classes by using their type name and assembly name together, but in a sufficiently complex system, this quickly becomes very difficult to manage. As an in-between option, you can also specify...