Example #1
0
        /// <summary>
        /// Use the direct routing topology with the given conventions
        /// </summary>
        /// <param name="transportExtensions"></param>
        /// <param name="routingKeyConvention">The routing key conventions.</param>
        /// <param name="exchangeNameConvention">The exchange name convention.</param>
        public static TransportExtensions <KafkaTransport> UseDirectRoutingTopology(this TransportExtensions <KafkaTransport> transportExtensions, Func <Type, string> routingKeyConvention = null, Func <Address, Type, string> exchangeNameConvention = null)
        {
            if (routingKeyConvention == null)
            {
                routingKeyConvention = DefaultRoutingKeyConvention.GenerateRoutingKey;
            }

            if (exchangeNameConvention == null)
            {
                exchangeNameConvention = (address, eventType) => "amq.topic";
            }

            //transportExtensions.GetSettings().Set<DirectRoutingTopology.Conventions>(new DirectRoutingTopology.Conventions(exchangeNameConvention, routingKeyConvention));

            return(transportExtensions);
        }
        public static TransportExtensions <SqlServerTransport> TransactionScopeOptions(
            this TransportExtensions <SqlServerTransport> transportExtensions,
            TimeSpan?timeout = null,
            IsolationLevel?isolationLevel = null)
        {
            if (timeout.HasValue)
            {
                transportExtensions.Transport.TransactionScope.Timeout = timeout.Value;
            }

            if (isolationLevel.HasValue)
            {
                transportExtensions.Transport.TransactionScope.IsolationLevel = isolationLevel.Value;
            }

            return(transportExtensions);
        }
Example #3
0
        /// <summary>
        /// Specifies a callback to apply to a subscription rule name.
        /// </summary>
        /// <param name="transportExtensions"></param>
        /// <param name="ruleNameFactory">The callback to apply.</param>
        /// <returns></returns>
        public static TransportExtensions <AzureServiceBusTransport> RuleNameFactory(this TransportExtensions <AzureServiceBusTransport> transportExtensions, Func <Type, string> ruleNameFactory)
        {
            Guard.AgainstNull(nameof(ruleNameFactory), ruleNameFactory);

            Func <Type, string> wrappedRuleNameFactory = eventType =>
            {
                try
                {
                    return(ruleNameFactory(eventType));
                }
                catch (Exception exception)
                {
                    throw new Exception("Custom rule name factory threw an exception.", exception);
                }
            };

            transportExtensions.GetSettings().Set(SettingsKeys.RuleNameFactory, wrappedRuleNameFactory);

            return(transportExtensions);
        }
 public static void DisableNativeTimeToBeReceivedInTransactions(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
 public static void EnableJournaling(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
 public static void DisableConnectionCachingForSends(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
 public static void DisableInstaller(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
 public static TransportExtensions <MsmqTransport> TransactionScopeOptions(
     this TransportExtensions <MsmqTransport> transportExtensions, TimeSpan?timeout = null,
     IsolationLevel?isolationLevel = null) => throw new NotImplementedException();
Example #9
0
        /// <summary>
        /// Configures the SQS transport to be compatible with 1.x versions of the transport.
        /// </summary>
        /// <param name="transportExtensions"></param>
        /// <returns></returns>
        public static TransportExtensions <SqsTransport> EnableV1CompatibilityMode(this TransportExtensions <SqsTransport> transportExtensions)
        {
            transportExtensions.GetSettings().Set(SettingsKeys.V1CompatibilityMode, true);

            return(transportExtensions);
        }
 /// <summary>
 /// Allows to change the transaction isolation level and timeout for the `TransactionScope` used to receive messages.
 /// </summary>
 /// <remarks>
 /// If not specified the default transaction timeout of the machine will be used and the isolation level will be set to
 /// `ReadCommited`.
 /// </remarks>
 public static TransportExtensions <MsmqTransport> TransactionScopeOptions(this TransportExtensions <MsmqTransport> transportExtensions, TimeSpan?timeout = null, IsolationLevel?isolationLevel = null)
 {
     transportExtensions.Settings.Set <MsmqScopeOptions>(new MsmqScopeOptions(timeout, isolationLevel));
     return(transportExtensions);
 }
 /// <summary>
 /// Set a delegate to use for applying the <see cref="Message.Label" /> property when sending a message.
 /// </summary>
 /// <remarks>
 /// This delegate will be used for all valid messages sent via MSMQ.
 /// This includes, not just standard messages, but also Audits, Errors and all control messages.
 /// In some cases it may be useful to use the <see cref="Headers.ControlMessageHeader" /> key to determine if a message is
 /// a control message.
 /// The only exception to this rule is received messages with corrupted headers. These messages will be forwarded to the
 /// error queue with no label applied.
 /// </remarks>
 public static TransportExtensions <MsmqTransport> ApplyLabelToMessages(this TransportExtensions <MsmqTransport> transportExtensions, Func <IReadOnlyDictionary <string, string>, string> labelGenerator)
 {
     Guard.AgainstNull(nameof(labelGenerator), labelGenerator);
     transportExtensions.Settings.Set("msmqLabelGenerator", labelGenerator);
     return(transportExtensions);
 }
 public static PipelineInvoker PipelineAccess <TBaseTransport>(
     this TransportExtensions <ServerlessTransport <TBaseTransport> > transportConfiguration) where TBaseTransport : TransportDefinition, new()
 {
     return(transportConfiguration.GetSettings().GetOrCreate <PipelineInvoker>());
 }
 public static TransportExtensions <TBaseTransport> BaseTransportConfiguration <TBaseTransport>(
     this TransportExtensions <ServerlessTransport <TBaseTransport> > transportConfiguration) where TBaseTransport : TransportDefinition, new()
 {
     return(new TransportExtensions <TBaseTransport>(transportConfiguration.GetSettings()));
 }
Example #14
0
        public static TransportExtensions <AcceptanceTestingTransport> UseNativeDelayedDelivery(this TransportExtensions <AcceptanceTestingTransport> transportExtensions, bool useNativeDelayedDelivery)
        {
            Guard.AgainstNull(nameof(transportExtensions), transportExtensions);

            transportExtensions.Settings.Set(AcceptanceTestingTransportInfrastructure.UseNativeDelayedDeliveryKey, useNativeDelayedDelivery);
            return(transportExtensions);
        }
Example #15
0
        public static TransportExtensions <AcceptanceTestingTransport> StorageDirectory(this TransportExtensions <AcceptanceTestingTransport> transportExtensions, string path)
        {
            Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
            Guard.AgainstNullAndEmpty(nameof(path), path);
            PathChecker.ThrowForBadPath(path, "StorageDirectory");

            transportExtensions.Settings.Set(AcceptanceTestingTransportInfrastructure.StorageLocationKey, path);
            return(transportExtensions);
        }
Example #16
0
 /// <summary>
 /// Configures the S3 Bucket that will be used to store message bodies
 /// for messages that are larger than 256k in size. If this option is not specified,
 /// S3 will not be used at all. Any attempt to send a message larger than 256k will
 /// throw if this option hasn't been specified. If the specified bucket doesn't
 /// exist, NServiceBus.AmazonSQS will create it when the endpoint starts up.
 /// Allows to optionally configure the client factory.
 /// </summary>
 /// <param name="transportExtensions">The transport extensions.</param>
 /// <param name="bucketForLargeMessages">The name of the S3 Bucket.</param>
 /// <param name="keyPrefix">The path within the specified S3 Bucket to store large message bodies.</param>
 /// <param name="encryption">S3 storage encryption algorithm.</param>
 public static S3Settings S3(this TransportExtensions <SqsTransport> transportExtensions, string bucketForLargeMessages, string keyPrefix, string encryption = null)
 {
     Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
     return(new S3Settings(transportExtensions.GetSettings(), bucketForLargeMessages, keyPrefix, encryption));
 }
Example #17
0
 /// <summary>
 /// Configures the SQS transport to support delayed messages of any duration.
 /// Without calling this API, delayed messages are subject to SQS Delivery Delay duration restrictions.
 /// </summary>
 public static TransportExtensions <SqsTransport> UnrestrictedDurationDelayedDelivery(this TransportExtensions <SqsTransport> transportExtensions)
 {
     return(transportExtensions.UnrestrictedDurationDelayedDelivery(maximumQueueDelayTime));
 }
Example #18
0
 public static TransportExtensions <SqlServerTransport> WithPeekDelay(this TransportExtensions <SqlServerTransport> transportExtensions, TimeSpan?delay = null)
 {
     throw new NotImplementedException();
 }
 public static TransportExtensions <MsmqTransport> ApplyLabelToMessages(
     this TransportExtensions <MsmqTransport> transportExtensions,
     Func <IReadOnlyDictionary <string, string>, string> labelGenerator) => throw new NotImplementedException();
 /// <summary>
 /// Configures the routing.
 /// </summary>
 public static RoutingSettings Routing(this TransportExtensions config)
 {
     Guard.AgainstNull(nameof(config), config);
     return(new RoutingSettings(config.Settings));
 }
 public static void UseDeadLetterQueueForMessagesWithTimeToBeReceived(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
 /// <summary>
 /// Configures the routing.
 /// </summary>
 public static RoutingSettings <T> Routing <T>(this TransportExtensions <T> config)
     where T : TransportDefinition
 {
     Guard.AgainstNull(nameof(config), config);
     return(new RoutingSettings <T>(config.Settings));
 }
 public static void DisableDeadLetterQueueing(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
Example #24
0
 /// <summary>
 /// Moves messages that have exceeded their TimeToBeReceived to the dead letter queue instead of discarding them.
 /// </summary>
 public static void UseDeadLetterQueueForMessagesWithTimeToBeReceived(this TransportExtensions <MsmqTransport> config)
 {
     Guard.AgainstNull(nameof(config), config);
     config.Settings.Set(MsmqTransport.UseDeadLetterQueueForMessagesWithTimeToBeReceived, true);
 }
 public static void UseNonTransactionalQueues(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
Example #26
0
 public static DelayedDeliverySettings DelayedDelivery(this TransportExtensions <RabbitMQTransport> transportExtensions)
 {
     throw new NotImplementedException();
 }
 public static void TimeToReachQueue(this TransportExtensions <MsmqTransport> config, TimeSpan timeToReachQueue) =>
 throw new NotImplementedException();
Example #28
0
        /// <summary>
        /// Internal use only.
        /// The queue names generated by the acceptance test suite are often longer than the SQS maximum of
        /// 80 characters. This setting allows queue names to be pre-truncated so the tests can work.
        /// The "pre-truncation" mechanism removes characters from the first character *after* the queue name prefix.
        /// For example, if the queue name prefix is "AcceptanceTest-", and the queue name is "abcdefg", and we need
        /// to have a queue name of no more than 20 characters for the sake of the example, the pre-truncated queue
        /// name would be "AcceptanceTest-cdefg".
        /// This gives us the ability to locate all queues by the given prefix, and we do not interfere with the
        /// discriminator or qualifier at the end of the queue name.
        /// </summary>
        internal static TransportExtensions <SqsTransport> PreTruncateQueueNamesForAcceptanceTests(this TransportExtensions <SqsTransport> transportExtensions, bool use = true)
        {
            Guard.AgainstNull(nameof(transportExtensions), transportExtensions);
            transportExtensions.GetSettings().Set(SettingsKeys.PreTruncateQueueNames, use);

            return(transportExtensions);
        }
 public static void IgnoreIncomingTimeToBeReceivedHeaders(this TransportExtensions <MsmqTransport> config) =>
 throw new NotImplementedException();
Example #30
0
        internal static TransportExtensions <SqsTransport> UnrestrictedDurationDelayedDelivery(this TransportExtensions <SqsTransport> transportExtensions, TimeSpan queueDelayTime)
        {
            Guard.AgainstNull(nameof(transportExtensions), transportExtensions);

            if (queueDelayTime < TimeSpan.FromSeconds(1) || queueDelayTime > maximumQueueDelayTime)
            {
                throw new ArgumentException("Queue delay needs to be between 1 second and 15 minutes.", nameof(queueDelayTime));
            }

            transportExtensions.GetSettings().Set(SettingsKeys.UnrestrictedDurationDelayedDeliveryQueueDelayTime, Convert.ToInt32(Math.Ceiling(queueDelayTime.TotalSeconds)));

            return(transportExtensions);
        }