public void GeneratesMessageIdBy(INewId instance) { if (instance == null) throw new ArgumentNullException(nameof(instance)); IdGenerator = instance; }
internal virtual IBasicProperties BuildBasicProperties(IMessageTypeResolver resolver, IDateTimeProvider dateTimeProvider, INewId idGenerator) { var properties = new BasicProperties { Headers = new Dictionary <String, Object>(), Persistent = false, ContentType = Headers.ContentType ?? SerializationConfiguration.DefaultContentType, ContentEncoding = Headers.ContentEncoding ?? SerializationConfiguration.DefaultContentEncoding, MessageId = Headers.MessageId ?? idGenerator.Next(), Timestamp = new AmqpTimestamp(Headers.Timestamp <= 0L ? dateTimeProvider.UtcNow().ToUnixTimestamp() : Headers.Timestamp) }; var binding = resolver.Resolve <TMessage>(); properties.Type = binding.RawName; if (binding.ExpiresAfter.HasValue) { properties.Expiration = binding.ExpiresAfter .GetValueOrDefault() .TotalMilliseconds .ToString(CultureInfo.InvariantCulture); } Headers.NonReservedHeaders().ToList().ForEach(_ => properties.Headers.Add(_.Key, _.Value)); return(properties); }
internal override IBasicProperties BuildBasicProperties(IMessageTypeResolver resolver, IDateTimeProvider dateTimeProvider, INewId idGenerator) { var properties = base.BuildBasicProperties(resolver, dateTimeProvider, idGenerator); properties.Persistent = true; return(properties); }
public void GeneratesMessageIdBy(INewId instance) { if (instance == null) { throw new ArgumentNullException(nameof(instance)); } IdGenerator = instance; }