public Task SendMessage(string address, OutgoingMessage message, IBasicProperties properties) { Task task; if (usePublisherConfirms) { task = GetConfirmationTask(); properties.SetConfirmationId(channel.NextPublishSeqNo); } else { task = TaskEx.CompletedTask; } if (properties.Headers.TryGetValue(DelayInfrastructure.DelayHeader, out var delayValue)) { var routingKey = DelayInfrastructure.CalculateRoutingKey((int)delayValue, address, out var startingDelayLevel); routingTopology.BindToDelayInfrastructure(channel, address, DelayInfrastructure.DeliveryExchange, DelayInfrastructure.BindingKey(address)); channel.BasicPublish(DelayInfrastructure.LevelName(startingDelayLevel), routingKey, true, properties, message.Body); } else { routingTopology.Send(channel, address, message, properties); } return(task); }
public Task PublishMessage(Type type, OutgoingMessage message, IBasicProperties properties) { var task = GetConfirmationTask(); properties.SetConfirmationId(channel.NextPublishSeqNo); routingTopology.Publish(channel, type, message, properties); return(task); }
public Task RawSendInCaseOfFailure(string address, ReadOnlyMemory <byte> body, IBasicProperties properties) { var task = GetConfirmationTask(); if (properties.Headers == null) { properties.Headers = new Dictionary <string, object>(); } properties.SetConfirmationId(channel.NextPublishSeqNo); routingTopology.RawSendInCaseOfFailure(channel, address, body, properties); return(task); }
public Task SendMessage(string address, string message, IBasicProperties properties) { try { var task = GetConfirmationTask(); properties.SetConfirmationId(channel.NextPublishSeqNo); channel.BasicPublish(address, string.Empty, true, properties, Encoding.UTF8.GetBytes(message)); return(task); } catch (Exception e) { Console.WriteLine(e); throw; } }
public Task PublishMessage(Type type, OutgoingMessage message, IBasicProperties properties) { Task task; if (usePublisherConfirms) { task = GetConfirmationTask(); properties.SetConfirmationId(channel.NextPublishSeqNo); } else { task = TaskEx.CompletedTask; } routingTopology.Publish(channel, type, message, properties); return(task); }
public Task RawSendInCaseOfFailure(string address, byte[] body, IBasicProperties properties) { Task task; if (usePublisherConfirms) { task = GetConfirmationTask(); properties.SetConfirmationId(channel.NextPublishSeqNo); } else { task = TaskEx.CompletedTask; } routingTopology.RawSendInCaseOfFailure(channel, address, body, properties); return(task); }