Five releases so far in January. Some bugs, some changes and then of course new features. Also managed to both remove support for .NET4.5+ and bring it back again. Sorry for that. The last release just added a new NuGet package MyNatsClient.Encodings.Json which introduces JsonEncoding
and some helper extension messages for publishing entities as JSON as well as reconstructing them in your handlers. Lets have a quick look.
Install the new package (.NET4.5+ and .NET Core via Standard 1.6):
install-package MyNatsClient.Encodings.Json
Import the namespace:
using MyNatsClient.Encodings.Json;
Publish using extension method, e.g.:
await client.PubAsJsonAsync("mySubject", new MyEntity { Value = 42 });
Consume and reconstruct entity, e.g.:
await client.SubWithHandlerAsync("mySubject", msg => {
var myEntity = msg.FromJson<MyEntity>();
//do something with it...
});
That's it. More encoders are to come. Will probably add the possibility to injected encoding/encoder or to register them and then have it be looked up by convetion. Not sure yet. Feel free to suggest what more there should be in this area.
Cheers,
//Daniel