示例#1
0
        public void SendExampleMessage2()
        {
            var content = new ExampleMessage2()
            {
                Guid = Guid.NewGuid()
            };

            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    MainQueue.DeclareQueue(channel);

                    var body = WrappedMessage.Wrap(ExampleMessage2.TypeID, content).ToBytes();
                    channel.BasicPublish(exchange: DefaultExchange.ExchangeName, routingKey: MainQueue.QueueName, basicProperties: null, body: body);
                }
        }
 private async Task <byte[]> Work(ExampleMessage2 message)
 {
     Logger.LogInformation($"Work2: {message.Guid}");
     return(await Task.FromResult <byte[]>(null));
 }