示例#1
0
        /// <summary>
        /// Конвертирует настройки публикации сообщения в заголовки сообщения.
        /// </summary>
        /// <param name="options">Настройки публикации сообщения.</param>
        /// <returns>Заголовки сообщения.</returns>
        private IDictionary <string, object> ApplyOptions(PublishingOptions options)
        {
            var storage       = this.Configuration.Options.GetIncomingMessageHeaderStorage().Value;
            var inputHeaders  = storage.Load() ?? new Dictionary <string, object>();
            var outputHeaders = new Dictionary <string, object>(inputHeaders);

            Headers.ApplyBreadcrumbs(outputHeaders, this.endpoint.Address);
            Headers.ApplyOriginalMessageId(outputHeaders);

            Maybe <bool> persist = BusOptions.Pick(options.Persistently, this.Configuration.Options.IsPersistently());

            Headers.ApplyPersistently(outputHeaders, persist);

            Maybe <TimeSpan?> ttl = BusOptions.Pick(options.Ttl, this.Configuration.Options.GetTtl());

            Headers.ApplyTtl(outputHeaders, ttl);

            return(outputHeaders);
        }