public static ResponseDetailsBase PushMessage <T>(this IModel channel, string exchange, string routingKey, T message) { var response = new ResponseDetailsBase(); try { // _logger.LogInformation("Pull Message From Service Bus Is Starting"); string serializedMessage = Newtonsoft.Json.JsonConvert.SerializeObject(message); var body = Encoding.UTF8.GetBytes(serializedMessage); channel.BasicPublish(exchange: exchange, routingKey: routingKey, basicProperties: null, body: body); //_logger.LogInformation("Push Message To Service Bus Comleted"); response.StatusCode = CommonEnums.ResponseStatusCode.Success; return(response); } catch (Exception ex) { response = new ResponseDetailsBase(ex); return(response); } }
public ResponseDetailsBase AckNowledge(ulong deleviryTag, IModel channel) { var response = new ResponseDetailsBase(); try { _logger.LogInformation("Pull Message From Service Bus Is Starting"); ConnectionFactory connFactory = new ConnectionFactory { Uri = new Uri(amqbUrl.Replace("amqp://", "amqps://")) }; channel.QueueDeclare(queue: "VehiclePing", durable: false, exclusive: false, autoDelete: false, arguments: null); channel.BasicAck(deleviryTag, true); _logger.LogInformation("Push Message To Service Bus Comleted"); response.StatusCode = CommonEnums.ResponseStatusCode.Success; return(response); } catch (Exception ex) { /// response = new ResponseDetailsBase(ex); return(response); } }