Пример #1
0
        public override void Publish <T>(ResourceEventType type, T payload)
        {
            byte[] messageBodyBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(payload));

            IBasicProperties props = channel.CreateBasicProperties();

            props.ContentType  = "application/json";
            props.DeliveryMode = 2;
            props.Headers      = new Dictionary <string, object> {
                { nameof(ResourceEventType), type.ToString() },
                { nameof(Type), typeof(T).AssemblyQualifiedName }
            };

            channel.BasicPublish(BlockInfo.Name,
                                 BlockInfo.Name, props,
                                 messageBodyBytes);
        }