Check a message against a real endpoint¶
Note
NServiceBus licensing. NServiceBus is dual-licensed: the Reciprocal Public License 1.5, or Particular Software's commercial agreement (particular.net/LicenseAgreement). This format was captured from NServiceBus 10.2.9, and only the module's own .NET test programs use it. The Go module itself does not depend on NServiceBus.
The module's testdata/ holds two small .NET programs. Neither is part of the Go module: Go ignores
testdata/, and NServiceBus stays out of the dependency graph.
Check what an endpoint sees¶
testdata/consumer is an NServiceBus endpoint, Shop.Billing, with a handler for PlaceOrder that
prints what .NET sees. Write messages with NServiceBus().Encode into its
.learningtransport/Shop.Billing/, the headers as a JSON object in <id>.metadata.txt and the body
in .bodies/<id>.body.txt, then run it:
$ docker run --rm -v "$PWD/testdata/consumer:/src" -w /src mcr.microsoft.com/dotnet/sdk:10.0 dotnet run
The handled type is Shop.Messages.PlaceOrder, with a payload of Order, a string, and Lines, an
integer, serialized with SystemJsonSerializer. The endpoint is configured with the Learning
transport and the Learning persistence, and with no retries.
Capture new messages¶
testdata/producer is a send-only endpoint, Shop.Sales, that sends two PlaceOrder messages to
Shop.Billing. The messages land in .learningtransport/Shop.Billing/, headers in *.metadata.txt and
bodies in .bodies/:
$ docker run --rm -v "$PWD/testdata/producer:/src" -w /src mcr.microsoft.com/dotnet/sdk:10.0 dotnet run
The first message is a bare Send. The second sets a message ID, a Tenant and a tenant header, and
sends inside an activity, so NServiceBus adds traceparent. They are send.txt and full.txt.