Simple SQL Server transport usage

Component: SQL Server Transport
NuGet Package NServiceBus.SqlServer (3.x)
Target NServiceBus Version: 6.x
Standard support for version 6.x of NServiceBus has expired. For more information see our Support Policy.

Prerequisites

An instance of SQL Server Express, accessible as .\SqlExpress.

At startup, each endpoint creates its required SQL assets, including databases, tables, and schemas.

The sample creates a database named SQLServerSimple.

Running the sample

  1. Start both the Sender and Receiver projects.
  2. At startup, Sender sends a message to Receiver.
  3. Receiver handles the message in the matching handler.

Code walk-through

Configuring the SQL Server transport

var transport = endpointConfiguration.UseTransport<SqlServerTransport>();
var connection = @"Data Source=.\SqlExpress;Database=SqlServerSimple;Integrated Security=True;Max Pool Size=100";
transport.ConnectionString(connection);

Related Articles


Last modified