public async Task <string> DateCalculate([FromBody] WhateverBusinessLib.DateMessage message) { await Task.Delay(500); var factory = new ConnectionFactory() { HostName = "localhost", UserName = ConnectionFactory.DefaultUser, Password = ConnectionFactory.DefaultPass, Port = AmqpTcpEndpoint.UseDefaultPort }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: CONFIG_QUEUE, durable: false, exclusive: false, autoDelete: false, arguments: null); var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(message)); channel.BasicPublish(exchange: "", routingKey: CONFIG_QUEUE, basicProperties: null, body: body); } return((message.Year + 1).ToString()); }
public async Task SendData(WhateverBusinessLib.DateMessage dateMessage, string url) { var trace = Trace.Create(); trace.Record(Annotations.LocalOperationStart("servicec1-post-operation")); trace.Record(Annotations.ServiceName("api.service-c2")); trace.Record(Annotations.Tag("vip-person-operation", "hey-elon-musk-hear-me")); trace.Record(Annotations.Tag("hr.api.code", "api-9999")); trace.Record(Annotations.Rpc(url)); trace.Record(Annotations.LocalAddr(new System.Net.IPEndPoint(IPAddress.Parse("192.19.07.28"), 1907))); trace.Record(Annotations.LocalOperationStop()); dateMessage.Year = dateMessage.Year + 1; dateMessage.CustomMessage = $"greeting from {dateMessage.Year}"; var content = new StringContent(JsonConvert.SerializeObject(dateMessage), System.Text.Encoding.UTF8, "application/json"); var task = await _client.PostAsync(url, content); var resultContent = await task.Content.ReadAsStringAsync(); }
public async Task <string> DateCalculate([FromBody] WhateverBusinessLib.DateMessage message) { await Task.Delay(500); return((message.Year + 1).ToString()); }