Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

Output Formatter
Since I’m handling Text, I’m going to be deriving from the TextOutputFormatter. This requires you to implement two methods:bool CanWriteType(Type type)
This method determines if your output formatter can handle the type returned from your controller action.
Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
Handle how yo want to transform the object returned from your controller action.
Lastly, you also need to define which media types your output formatter will handle. In other words, when the client sends an Accept: header, which values apply to your output formatter.
In my case, Siren uses application/vnd.siren+json
MVC Options
Finally, in our startup, we need to add our new Output Formatter in the AddMVC extension method.Results
Here are two different outputs. The first is with anAccept: application/json
and the second is requestion Siren with Accept: application/vnd.siren+json

