Skip to content

What does not round-trip through MassTransit

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.

Every other field of an event this format wrote reads back exactly, with nothing in Foreign. These are the exceptions, and they come from MassTransit's envelope rather than from care.

Between Go and Go

Event Reads back as Why
Time with nanoseconds Truncated to 100 ns sentTime is a .NET tick. A time already on a tick is kept exactly.
No Data {} MassTransit refuses a message that is null or absent.
SpecVersion empty 1.0 The format fills it in.

Data is otherwise byte for byte: [1, 2,3] reads back as [1, 2,3]. The format splices the payload in rather than letting encoding/json compact it.

Between Go and .NET

Direction What differs
Go to .NET A relative Source arrives as a file:/// URI.
Go to .NET Time is written with seven fractional digits in UTC.
Go to .NET Subject, DataSchema and DataContentType are headers named ce-.... A consumer that does not look for them does not see them.
.NET to Go DataContentType is empty. MassTransit does not write one.
.NET to Go Only the first messageType is the type. The interfaces a message implements are in Foreign.Headers["messageType"].
.NET to Go correlationId, conversationId, host and the rest are Foreign, and are not sent back.
.NET to Go A producer's header with a capital letter, such as Tenant, is foreign. Only a name of lower-case letters and digits is an extension.
.NET to Go sentTime keeps whatever precision and offset MassTransit wrote. A time that has an offset is read with it.

What no event can carry

The format writes the six members above and the ce- headers, and nothing else. A Go service cannot set correlationId, conversationId, requestId, expirationTime, a fault address or a response address on a message it sends. Correlation is the transport's job in this design, and the foreign bag is read-only.

Empty and null headers

In v0.1.0, the released version, a null header under a valid extension name, such as "priority": null, is read as an extension with an empty value, and Validate refuses the whole message with ErrMissingAttribute. Any other null header, such as "Tenant": null, arrives as a foreign header holding one empty string.

From the next release, a null header is read as absent, so neither reaches the event or the foreign bag (envelope-masstransit!9).

An empty string is not absent. "priority": "" is an extension with an empty value, which Validate refuses, and "Tenant": "" stays foreign as one empty string. For the same reason an event whose extension value is empty cannot be written at all: Validate refuses it first.