Monitor SQS transport with ServiceControl adapter

Component: ServiceControl Transport Adapter
NuGet Package ServiceControl.TransportAdapter (2.x)
Target NServiceBus Version: 7.x

This sample shows how to configure ServiceControl to monitor endpoints and retry messages when using SQS transport. The user endpoint in this solution uses the SQS transport while ServiceControl runs on MSMQ.


  1. Install ServiceControl.
  2. Using ServiceControl Management tool, set up ServiceControl to monitor endpoints using MSMQ transport:
  • Add a new ServiceControl instance:
  • Use default Particular.ServiceControl as the instance name (ensure there is no other instance of SC running with the same name).
If other ServiceControl instances have been running on this machine, it's necessary to specify a non-default instance name and port number. Adjust ServicePulse settings accordingly to point to this location.
  1. Ensure the ServiceControl process is running before running the sample.
  2. Install ServicePulse
  3. Set up Amazon SQS using instructions from the simple SQS sample.

Running the project

  1. Start the Adapter and Endpoint projects.
  2. Open ServicePulse (by default it's available at http://localhost:9090/#/dashboard) and select the Endpoints Overview. Samples.ServiceControl.SqsTransportAdapter.Endpoint endpoint should be visible in the Active Endpoints tab as it has the Heartbeats plugin installed.
  3. Go to the Endpoint console and press o to send a message.
  4. Notice the endpoint receives its own message and successfully processes it.
  5. Press f to simulate message processing failure.
  6. Press o to create more messages.
  7. Notice messages failed processing.
  8. Open ServicePulse and select the Failed Messages view.
  9. Notice the existence of one failed message group. Open the group.
  10. Press the "Retry all" button.
  11. Go to the Endpoint console and verify that the message has been successfully processed.
  12. Shut down the Endpoint.
  13. Open ServicePulse and notice a red label next to the heart icon. Click on the that icon to open the Endpoints Overview. Notice that Samples.ServiceControl.SqsTransportAdapter.Endpoint is now displayed in the Inactive Endpoints tab.

Code walk-through

The code base consists of two projects.


The Endpoint project contains an endpoint that simulates the execution of a business process by sending a message to itself. It includes a message processing failure simulation mode (toggled by pressing f) which can be used to generate failed messages for demonstrating message retry functionality. The endpoint uses the SQS transport.

The endpoint has the Heartbeats plugin installed to enable uptime monitoring via ServicePulse.


The Adapter project hosts the ServiceControl.TransportAdapter. The adapter has two sides: endpoint-facing and ServiceControl-facing. In this sample the endpoint-facing side uses SQS transport and the ServiceControl-facing side uses MSMQ:

var transportAdapterConfig = new TransportAdapterConfig<SqsTransport, MsmqTransport>("ServiceControl.SQS.Adapter");

The following code configures the adapter to use SQL Server transport when communicating with the business endpoints (Shipping).

transportAdapterConfig.CustomizeEndpointTransport(transport =>
    transport.S3("bucketname", "my/key/prefix");

Related Articles

Last modified