static void DoIt(TransportConfigurer configurer, string connectionString, string inputQueueName, string errorQueueName)
 {
     var queue = new RabbitMqMessageQueue(connectionString, inputQueueName, errorQueueName);
     configurer.UseSender(queue);
     configurer.UseReceiver(queue);
     configurer.UseErrorTracker(new ErrorTracker(errorQueueName));
 }
        static void DoIt(TransportConfigurer configurer, string connectionString, string inputQueueName, string errorQueueName)
        {
            var queue = new RabbitMqMessageQueue(connectionString, inputQueueName, errorQueueName);

            configurer.UseSender(queue);
            configurer.UseReceiver(queue);
            configurer.UseErrorTracker(new ErrorTracker(errorQueueName));
        }
Exemplo n.º 3
0
        public static void UseMsmqInOneWayClientMode(this TransportConfigurer configurer)
        {
            var msmqMessageQueue = MsmqMessageQueue.Sender();

            configurer.UseSender(msmqMessageQueue);
            var gag = new OneWayClientGag();

            configurer.UseReceiver(gag);
            configurer.UseErrorTracker(gag);
        }
        public static void UseRabbitMqAndGetInputQueueNameFromAppConfig(this TransportConfigurer configurer, string connectionString)
        {
            try
            {
                var section = RebusConfigurationSection.LookItUp();

                var inputQueueName = section.InputQueue;

                if (string.IsNullOrEmpty(inputQueueName))
                {
                    throw new ConfigurationErrorsException("Could not get input queue name from Rebus configuration section. Did you forget the 'inputQueue' attribute?");
                }

                var errorQueueName = section.ErrorQueue;

                if (string.IsNullOrEmpty(errorQueueName))
                {
                    throw new ConfigurationErrorsException("Could not get input queue name from Rebus configuration section. Did you forget the 'errorQueue' attribute?");
                }

                DoIt(configurer, connectionString, inputQueueName, errorQueueName);
            }
            catch (ConfigurationErrorsException e)
            {
                throw new ConfigurationException(
                          @"
An error occurred when trying to parse out the configuration of the RebusConfigurationSection:

{0}

-

For this way of configuring input queue to work, you need to supply a correct configuration
section declaration in the <configSections> element of your app.config/web.config - like so:

    <configSections>
        <section name=""rebus"" type=""Rebus.Configuration.RebusConfigurationSection, Rebus"" />
        <!-- other stuff in here as well -->
    </configSections>

-and then you need a <rebus> element some place further down the app.config/web.config,
like so:

    <rebus inputQueue=""my.service.input.queue"" errorQueue=""my.service.error.queue"" />

Note also, that specifying the input queue name with the 'inputQueue' attribute is optional.

A more full example configuration snippet can be seen here:

{1}
",
                          e, RebusConfigurationSection.ExampleSnippetForErrorMessages);
            }
        }
        static void DoIt(TransportConfigurer configurer, string inputQueueName, string errorQueueName)
        {
            if (string.IsNullOrEmpty(inputQueueName))
            {
                throw new ConfigurationErrorsException("You need to specify an input queue.");
            }

            var msmqMessageQueue = new MsmqMessageQueue(inputQueueName, errorQueueName);

            configurer.UseSender(msmqMessageQueue);
            configurer.UseReceiver(msmqMessageQueue);
        }
        static void DoItEncrypted(TransportConfigurer configurer, string inputQueueName, string iv, string key, string errorQueueName)
        {
            if (string.IsNullOrEmpty(inputQueueName))
            {
                throw new ConfigurationErrorsException("You need to specify an input queue.");
            }

            var msmqMessageQueue = new MsmqMessageQueue(inputQueueName, errorQueueName);
            var encryptionFilter = new RijndaelEncryptionTransportDecorator(msmqMessageQueue, msmqMessageQueue, iv, key);

            configurer.UseSender(encryptionFilter);
            configurer.UseReceiver(encryptionFilter);
        }
Exemplo n.º 7
0
        static void DoIt(TransportConfigurer configurer, string inputQueueName, string errorQueueName)
        {
            if (string.IsNullOrEmpty(inputQueueName))
            {
                throw new ConfigurationErrorsException("You need to specify an input queue.");
            }

            var msmqMessageQueue = new MsmqMessageQueue(inputQueueName);

            var errorQueuePath = MsmqUtil.GetPath(errorQueueName);

            MsmqUtil.EnsureMessageQueueExists(errorQueuePath);
            MsmqUtil.EnsureMessageQueueIsTransactional(errorQueuePath);

            configurer.UseSender(msmqMessageQueue);
            configurer.UseReceiver(msmqMessageQueue);
            configurer.UseErrorTracker(new ErrorTracker(errorQueueName));
        }
 public static void UseRabbitMq(this TransportConfigurer configurer, string connectionString, string inputQueueName, string errorQueue)
 {
     DoIt(configurer, connectionString, inputQueueName, errorQueue);
 }
Exemplo n.º 9
0
        public static void UseEncryptedMsmqAndGetConfigurationFromAppConfig(this TransportConfigurer configurer)
        {
            try
            {
                var section = RebusConfigurationSection.LookItUp();

                var inputQueueName = section.InputQueue;

                if (string.IsNullOrEmpty(inputQueueName))
                {
                    throw new ConfigurationErrorsException("Could not get input queue name from Rebus configuration section. Did you forget the 'inputQueue' attribute?");
                }

                var errorQueueName = section.ErrorQueue;

                if (string.IsNullOrEmpty(errorQueueName))
                {
                    throw new ConfigurationErrorsException("Could not get error queue name from Rebus configuration section. Did you forget the 'errorQueue' attribute?");
                }

                var rijndael = section.RijndaelSection;

                if (rijndael == null)
                {
                    throw new ConfigurationErrorsException(string.Format(@"Could not find encryption settings in Rebus configuration section. Did you forget the 'rijndael' element?

{0}", GenerateRijndaelHelp()));
                }

                if (string.IsNullOrEmpty(rijndael.Iv))
                {
                    throw new ConfigurationErrorsException(string.Format(@"Could not find initialization vector settings in Rijndael element - did you forget the 'iv' attribute?

{0}", GenerateRijndaelHelp()));
                }

                if (string.IsNullOrEmpty(rijndael.Key))
                {
                    throw new ConfigurationErrorsException(string.Format(@"Could not find key settings in Rijndael element - did you forget the 'key' attribute?

{0}", GenerateRijndaelHelp()));
                }

                DoItEncrypted(configurer, inputQueueName, rijndael.Iv, rijndael.Key, errorQueueName);
            }
            catch (ConfigurationErrorsException e)
            {
                throw new ConfigurationException(
                          @"
An error occurred when trying to parse out the configuration of the RebusConfigurationSection:

{0}

-

For this way of configuring input queue to work, you need to supply a correct configuration
section declaration in the <configSections> element of your app.config/web.config - like so:

    <configSections>
        <section name=""rebus"" type=""Rebus.Configuration.RebusConfigurationSection, Rebus"" />
        <!-- other stuff in here as well -->
    </configSections>

-and then you need a <rebus> element some place further down the app.config/web.config,
like so:

    <rebus InputQueue=""my.service.input.queue"">
        <rijndael iv=""base64 encoded initialization vector"" key=""base64 encoded key""/>
    </rebus>

Note also, that specifying the input queue name with the 'inputQueue' attribute is optional.

A more full example configuration snippet can be seen here:

{1}
",
                          e, RebusConfigurationSection.ExampleSnippetForErrorMessages);
            }
        }
Exemplo n.º 10
0
 public static void UseEncryptedMsmq(this TransportConfigurer configurer, string inputQueue, string errorQueue, string ivBase64, string keyBase64)
 {
     DoItEncrypted(configurer, inputQueue, ivBase64, keyBase64, errorQueue);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Specifies that you want to use MSMQ to both send and receive messages. The input
 /// queue will be automatically created if it doesn't exist.
 /// </summary>
 public static void UseMsmq(this TransportConfigurer configurer, string inputQueue, string errorQueue)
 {
     DoIt(configurer, inputQueue, errorQueue);
 }
Exemplo n.º 12
0
        static void DoItEncrypted(TransportConfigurer configurer, string inputQueueName, string iv, string key)
        {
            if (string.IsNullOrEmpty(inputQueueName))
            {
                throw new ConfigurationErrorsException("You need to specify an input queue.");
            }

            var msmqMessageQueue = new MsmqMessageQueue(inputQueueName);
            var encryptionFilter = new EncryptionFilter(msmqMessageQueue, msmqMessageQueue, iv, key);

            configurer.UseSender(encryptionFilter);
            configurer.UseReceiver(encryptionFilter);
        }
Exemplo n.º 13
0
        static void DoIt(TransportConfigurer configurer, string inputQueueName)
        {
            if (string.IsNullOrEmpty(inputQueueName))
            {
                throw new ConfigurationErrorsException("You need to specify an input queue.");
            }

            var msmqMessageQueue = new MsmqMessageQueue(inputQueueName);

            configurer.UseSender(msmqMessageQueue);
            configurer.UseReceiver(msmqMessageQueue);
        }