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.

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];
        }
    }

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.16 297 6/12/2019
1.1.15 225 6/8/2019
1.1.14 155 6/6/2019
1.1.13 271 6/3/2019
1.1.12 89 6/3/2019
1.1.11 94 6/2/2019
1.1.10 75 5/13/2019
1.1.9 56 5/11/2019