public void Emit(IRabbitMqEvent @event, string exchange, string exchangeType = "topic", TimeSpan?initialVisibilityDelay = null, TimeSpan?expiration = null, bool isMessagePersistent = true, bool isMessageMandatory = false, (string headerKey, string headerValue)[]?additionalHeaders = null)
public static string GetRoutingKeyFromEvent(IRabbitMqEvent @event) { var eventType = @event.GetType(); var tokens = GetTokens(eventType); if (tokens.Length == 0) { return($"{eventType.GetReadableNameFromType()}"); } var segments = tokens.Select(token => @event.GetType().GetProperty(token.PropertyInfo.Name).GetValue(@event, null)) .Select(obj => null == obj ? All : obj.ToString()) .Aggregate((token1, token2) => $"{token1}{Separator}{token2}"); return($"{eventType.GetReadableNameFromType()}.{segments}"); }
public RabbitMqQueueMessage( Guid messageId, IRabbitMqConnection rabbitMqConnection, Type type, IRabbitMqEvent content, bool redelivered, ulong deliveryTag, bool isAutoAck) { _rabbitMqConnection = rabbitMqConnection; _deliveryTag = deliveryTag; _isAutoAck = isAutoAck; MessageId = messageId; Type = type; Content = content; DequeueCount = redelivered ? 1 : 0; }