Exemple #1
0
        private void OnDeleteQueue(Guid clientId, TopicDelete topicDelete)
        {
            _logger.LogInformation($"Deleting topic: {topicDelete.Name}");

            _topicStore.Delete(topicDelete.Name);

            SendReceivedPayloadOk(clientId, topicDelete.Id);
        }
        public SerializedPayload NewDeleteTopic(string name)
        {
            var payload = new TopicDelete
            {
                Id   = Guid.NewGuid(),
                Name = name
            };

            return(_serializer.Serialize(payload));
        }
        public void Serialization_TopicDelete_MatchResults()
        {
            var queue = new TopicDelete {
                Id = Guid.NewGuid(), Name = RandomGenerator.GenerateString(10)
            };

            var b = _serializer.Serialize(queue);

            var result = _deserializer.ToTopicDelete(b.DataWithoutSize);

            Assert.Equal(queue.Id, result.Id);
            Assert.Equal(queue.Name, result.Name);
        }
        public SerializedPayload Serialize(TopicDelete topicDelete)
        {
            var binaryWriter = ObjectPool.Shared.Rent <BinaryProtocolWriter>();

            try
            {
                return(binaryWriter
                       .WriteType(PayloadType.TopicDelete)
                       .WriteId(topicDelete.Id)
                       .WriteStr(topicDelete.Name)
                       .ToSerializedPayload());
            }
            finally
            {
                ObjectPool.Shared.Return(binaryWriter);
            }
        }