RabbitExpress.Serializers.MsgPackSerializer 1.1.16

A simple MsgPack serializer implementation for usage in RabbitExpress.

Install-Package RabbitExpress.Serializers.MsgPackSerializer -Version 1.1.16
dotnet add package RabbitExpress.Serializers.MsgPackSerializer --version 1.1.16
<PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.1.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RabbitExpress.Serializers.MsgPackSerializer --version 1.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RabbitExpress.Serializers.MsgPackSerializer, 1.1.16"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install RabbitExpress.Serializers.MsgPackSerializer as a Cake Addin
#addin nuget:?package=RabbitExpress.Serializers.MsgPackSerializer&version=1.1.16

// Install RabbitExpress.Serializers.MsgPackSerializer as a Cake Tool
#tool nuget:?package=RabbitExpress.Serializers.MsgPackSerializer&version=1.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MsgPack Serializer

This library provides an implementation of a very simple serializer.

Add the reference

In your csproj add a PackageReference to this package.

<ItemGroup>
    <PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.*" />
</ItemGroup>

The serializer

This is a very simple serializer to be used in the RabbitExpress.QueueClient. The implementation uses MsgPack.Cli to serialize and deserialize the transfered messages.

    public class MsgPackSerializer : IExpressSerializer
    {
        private static readonly ConcurrentDictionary<Type, MessagePackSerializer> SerializerCache =
            new ConcurrentDictionary<Type, MessagePackSerializer>();

        public TObject Deserialize<TObject>(byte[] data)
        {
            var responseSerializer = SerializerCache.GetOrAdd(typeof(TObject), MessagePackSerializer.Get<TObject>()) as MessagePackSerializer<TObject>;
            if (responseSerializer != null)
                return responseSerializer.UnpackSingleObject(data);

            return default(TObject);
        }

        public byte[] Serialize<TObject>(TObject value)
        {
            var responseSerializer = SerializerCache.GetOrAdd(typeof(TObject), MessagePackSerializer.Get<TObject>()) as MessagePackSerializer<TObject>;
            if (responseSerializer != null)
                return responseSerializer.PackSingleObject(value);

            return new byte[0];
        }
    }

MsgPack Serializer

This library provides an implementation of a very simple serializer.

Add the reference

In your csproj add a PackageReference to this package.

<ItemGroup>
    <PackageReference Include="RabbitExpress.Serializers.MsgPackSerializer" Version="1.*" />
</ItemGroup>

The serializer

This is a very simple serializer to be used in the RabbitExpress.QueueClient. The implementation uses MsgPack.Cli to serialize and deserialize the transfered messages.

    public class MsgPackSerializer : IExpressSerializer
    {
        private static readonly ConcurrentDictionary<Type, MessagePackSerializer> SerializerCache =
            new ConcurrentDictionary<Type, MessagePackSerializer>();

        public TObject Deserialize<TObject>(byte[] data)
        {
            var responseSerializer = SerializerCache.GetOrAdd(typeof(TObject), MessagePackSerializer.Get<TObject>()) as MessagePackSerializer<TObject>;
            if (responseSerializer != null)
                return responseSerializer.UnpackSingleObject(data);

            return default(TObject);
        }

        public byte[] Serialize<TObject>(TObject value)
        {
            var responseSerializer = SerializerCache.GetOrAdd(typeof(TObject), MessagePackSerializer.Get<TObject>()) as MessagePackSerializer<TObject>;
            if (responseSerializer != null)
                return responseSerializer.PackSingleObject(value);

            return new byte[0];
        }
    }

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.16 508 6/12/2019
1.1.15 399 6/8/2019
1.1.14 327 6/6/2019
1.1.13 444 6/3/2019
1.1.12 262 6/3/2019
1.1.11 261 6/2/2019
1.1.10 265 5/13/2019
1.1.9 233 5/11/2019