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

Creating a service endpoint


Now we're going to create a service endpoint—a process that will host code to handle our command message:

  1. Add a new class library project to your solution. Name the project UserService.

  2. Delete the Class1.cs file that came with the class project.

  3. From the NuGet Package Manager Console window, run this command to install the NServiceBus.Host package:

    PM> Install-Package NServiceBus.Host –ProjectName UserService
    
  4. Take a look at what the host package has added to your class library. Don't worry; we'll cover this in more detail later:

    • References to NServiceBus.Host.exe and NServiceBus.Core.dll

    • An App.config file

    • A class named EndpointConfig.cs

    • Project debug settings to execute NServiceBus.Host.exe when we debug

  5. In the service project, add a reference to the UserService.Messages project you created before.

  6. In the EndpointConfig.cs class that was generated, replace the text PLEASE_SELECT_ONE with InMemoryPersistence. You may need to add a using NServiceBus.Persistence; declaration to the file if you don't have a tool such as ReSharper to do it for you.