private async Task <string> CreateResponse(BasicDeliverEventArgs ea) { var takedMessage = Encoding.UTF8.GetString(ea.Body.Span); logger.LogInformation("takedMessage:" + takedMessage); List <CashOrder> ordersList = new List <CashOrder>(); ordersList = CashOrdersSerializer.Deserialize(takedMessage); ordersList = await RepositoryHelper.GetOrCreateOrders(ordersList, db); return(CashOrdersSerializer.Serialize(ordersList)); }
/// <summary> /// Send message to message queue /// </summary> private List <CashOrder> SendMessage(CashOrder cashOrder) { List <CashOrder> ordersList = new List <CashOrder>(); ordersList.Add(cashOrder); string json = CashOrdersSerializer.Serialize(ordersList); try { sender = new Sender(configuration); var response = sender.Call(json); ordersList = CashOrdersSerializer.Deserialize(response); return(ordersList); } catch (Exception ex) { throw; } finally { sender.Close(); } }