Check a message against a real consumer¶
Warning
MassTransit 9 is commercially licensed. MassTransit 9 and later is under the MassTransit Commercial Software License Agreement (massient.com/license), a paid subscription with no exemption for testing. This format was captured from MassTransit 8, which is Apache-2.0, and the module's own .NET test programs stay on 8.x (envelope-masstransit#1). The Go module itself does not depend on MassTransit.
The module's testdata/ holds two small .NET programs. Neither is part of the Go module: Go ignores
testdata/, and MassTransit stays out of the dependency graph.
Check what a consumer sees¶
testdata/consumer reads every .json file in a directory with MassTransit's own
SystemTextJsonMessageSerializer, as a consumer of OrderCreated would, and prints what .NET sees.
Write bodies with MassTransit().Encode into a directory, $DIR, then:
$ docker run --rm -v "$PWD/testdata/consumer:/src" -v "$DIR:/in" -w /src \
mcr.microsoft.com/dotnet/sdk:9.0 dotnet run -- /in
The message type the program consumes is Capture.OrderCreated, so write events with the type
Capture:OrderCreated. Its payload is Order, a string, and Lines, an integer.
Capture new messages¶
testdata/producer starts MassTransit's in-memory bus, publishes two messages and prints each as
the consumer received it: the content type, each transport header, then the body after a blank line.
$ docker run --rm -v "$PWD/testdata/producer:/src" -w /src mcr.microsoft.com/dotnet/sdk:9.0 dotnet run
The first message is a bare Publish. The second sets a message ID, a correlation ID, a Tenant
header and a traceparent inside an activity. They are plain.txt and full.txt.
Stay on 8.x¶
Both programs reference MassTransit 8. MassTransit 9 and later is commercially licensed, so do not bump them. See the notice at the top of this page and envelope-masstransit#1.