You are previewing Learning NServiceBus - Second Edition.
O'Reilly logo
Learning NServiceBus - Second Edition

Book Description

Build reliable and scalable distributed software systems using the industry leading .NET Enterprise Service Bus

In Detail

Building complex software systems is hard, but it doesn't have to be! NServiceBus is a powerful, yet lightweight, open source messaging framework used to design distributed .NET enterprise systems. Entirely pluggable, yet simple to use, it can help you apply the principles of messaging and SOA to build robust, scalable, and maintainable systems.

This book is an essential guide that will help you become a messaging guru. From sending a simple message, to publishing events, to implementing complex long-running business processes, you'll learn everything you need to know to start building complex software systems in no time.

What You Will Learn

  • Create systems that can be maintained and upgraded without downtime

  • Make your web service integrations reliable

  • Create code that automatically compensates for failures

  • Apply the principles of messaging theory and eventual consistency

  • Decouple and simplify business processes with Publish/Subscribe

  • Replace batch jobs with business processes that are reliable, adaptable, and testable

  • Create software that can scale horizontally as well as vertically

  • Monitor your software for health, performance, and adherence to SLAs

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Learning NServiceBus Second Edition
      1. Table of Contents
      2. Learning NServiceBus Second Edition
      3. Credits
      4. Foreword
        1. Early influences
        2. Starting with MSMQ
        3. What open source meant in those days
        4. Clouds on the horizon
          1. Unexpected success
          2. Fast-forward to today
          3. Back to David, and this book
      5. About the Author
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
          3. Instant updates on new Packt books
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Getting on the IBus
        1. Why use NServiceBus?
        2. Getting the code
          1. NServiceBus NuGet packages
        3. Our first example
        4. Creating a message assembly
        5. Creating a service endpoint
        6. Creating a message handler
        7. Sending a message from an MVC application
          1. Creating the MVC website
        8. Running the solution
        9. Summary
      10. 2. Messaging Patterns
        1. Commands versus events
          1. Eventual consistency
          2. Achieving consistency with messaging
        2. Events
          1. Publishing an event
          2. Subscribing to an event
        3. Message routing
        4. Summary
      11. 3. Preparing for Failure
        1. Fault tolerance and transactional processing
        2. Error queues and replay
          1. Automatic retries
          2. Replaying errors
          3. Second-level retries
          4. RetryDemo
        3. Messages that expire
        4. Auditing messages
        5. Web service integration and idempotence
        6. Summary
      12. 4. Hosting
        1. Hosting types
          1. NServiceBus-hosted endpoints
          2. Self-hosted endpoints
        2. Assembly scanning
        3. Choosing an endpoint name
        4. Dependency injection
        5. Message transport
          1. Reasons to use a different transport
          2. MSMQ
          3. RabbitMQ
          4. SQL Server
          5. Windows Azure
        6. Persistence
          1. In-memory persistence
          2. NHibernate
          3. RavenDB
          4. Windows Azure
          5. Polyglot persistence
        7. Message serialization
        8. Transactions
        9. Purging the queue on startup
        10. Installers
        11. Startup
          1. Send-only endpoints
        12. Summary
      13. 5. Advanced Messaging
        1. Unobtrusive mode
          1. TimeToBeReceived attribute
        2. Message versioning
          1. Polymorphic dispatch
          2. Events as interfaces
        3. Specifying the handler order
        4. Message actions
          1. Stopping a message
          2. Deferring a message
          3. Forwarding messages
          4. Message headers
        5. Property encryption
        6. Transporting large payloads
        7. Exposing web services
        8. Summary
      14. 6. Sagas
        1. Long-running processes
        2. Defining a saga
        3. Finding saga data
        4. Ending a saga
        5. Dealing with time
        6. Design guidelines
          1. Business logic only
          2. Saga lifetime
          3. Saga patterns
          4. Messages that start sagas
          5. Retraining business stakeholders
        7. Persistence concerns
          1. RavenDB
          2. NHibernate
          3. Azure
        8. Unit testing
          1. Testing events as interfaces
        9. Scheduling
        10. Summary
      15. 7. Advanced Configuration
        1. Extending NServiceBus
          1. IConfigureThisEndpoint
          2. INeedInitialization
          3. IWantToRunWhenBusStartsAndStops
        2. Dependency injection
        3. Unit of work
        4. Message mutators
        5. The NServiceBus pipeline
          1. Building behaviors
          2. Ordering behaviors
          3. Replacing behaviors
          4. The pipeline context
        6. Outbox
          1. DTC 101
          2. Life without distributed transactions
          3. Outbox configuration
          4. Session sharing
        7. Summary
      16. 8. The Service Platform
        1. ServiceControl
        2. ServiceInsight
          1. Endpoint Explorer
          2. Messages
          3. Main view
            1. Flow Diagram
            2. Saga
            3. Sequence Diagram
            4. Other tabs
        3. ServicePulse
          1. Endpoint activity
          2. Failed messages
          3. Custom checks
          4. Getting notified
        4. ServiceMatrix
        5. Summary
      17. 9. Administration
        1. Service installation
          1. Infrastructure installers
          2. Side-by-side installation
        2. Profiles
          1. Environmental profiles
          2. Feature profiles
          3. Customizing profiles
          4. Logging profiles
            1. Customizing the log level
        3. Managing configurations
        4. Monitoring performance
        5. Scalability
          1. Scaling up
          2. Scaling out
            1. Decommissioning a MSMQ worker
            2. Extreme scale
        6. Multiple sites
        7. Virtualization
          1. MSMQ message storage
          2. Clustering
        8. Transport administration
        9. Summary
      18. 10. Where to Go from Here?
        1. What we've learned
        2. What next?
      19. Index