コード例 #1
0
 public Task Handle(CustomerActionNotification notification, CancellationToken cancellationToken)
 {
     return(Task.Run(() =>
     {
         _rabbitMq.PublishMessage("Customer", notification);
     }));
 }
コード例 #2
0
        public void SendMessage(INameMessage nameMessage)
        {
            if (nameMessage == null)
            {
                throw new ArgumentNullException(nameof(nameMessage));
            }

            var objNameMessage = new NameMessage
            {
                Message = nameMessage.Message
            };

            var serializedMessage = JsonConvert.SerializeObject(objNameMessage);

            _rabbitMqService.CreateConnection();
            _rabbitMqService.PublishMessage(serializedMessage);
            _rabbitMqService.CloseConnection();
        }