コード例 #1
0
        public void can_shutdown_and_restart_connections_on_seperate_threads()
        {
            new MessagingBaseConfiguration()
            .WithDefaults()
            .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());

            var anyFails = false;

            var b = new Thread(() =>
            {
                for (int i = 0; i < 100; i++)
                {
                    _conn.Dispose();
                    Thread.Sleep(100);
                }
            });
            var a = new Thread(() =>
            {
                for (int i = 0; i < 100; i++)
                {
                    if (!_conn.GetWithChannel(c => c.IsOpen))
                    {
                        anyFails = true;
                    }
                    Thread.Sleep(100);
                }
            });

            a.Start();
            b.Start();

            Assert.That(a.Join(TimeSpan.FromSeconds(20)));
            Assert.That(b.Join(TimeSpan.FromSeconds(20)));
            Assert.False(anyFails, "channel was closed during an operation");
        }
コード例 #2
0
        public void setup()
        {
            var config = new MessagingBaseConfiguration()
                         .WithDefaults()
                         .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());

            _conn = config.Get <IChannelAction>();
        }
コード例 #3
0
        public void setup()
        {
            _config = new MessagingBaseConfiguration()
                      .WithDefaults()
                      //.UsesSecureConnections() // If you don't have HTTPS set up, comment out this line
                      .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());

            _messaging = _config.GetMessagingBase();

            _query = ConfigurationHelpers.RabbitMqQueryWithConfigSettings();
        }
コード例 #4
0
        public void can_repeatedly_configure_and_shutdown_messaging()
        {
            for (int i = 0; i < 20; i++)
            {
                var config = new MessagingBaseConfiguration()
                             .WithDefaults()
                             .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());

                config.Shutdown();
            }
        }
コード例 #5
0
        public void setup()
        {
            _config = new MessagingBaseConfiguration()
                      .WithDefaults()
                      .UsesSecureConnections()
                      .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());

            _messaging = _config.GetMessagingBase();

            _query = ConfigurationHelpers.RabbitMqQueryWithConfigSettings();
        }
コード例 #6
0
        public void setup()
        {
            _config = new MessagingBaseConfiguration()
                      .WithDefaults()
                      .SetDefaultAcknowledgeTimeout(TimeSpan.FromSeconds(1))
                      .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings());


            var msg = _config.GetMessagingBase();

            msg.CreateDestination <IMetadataFile>("ReleaseTestQueue", Expires.Never);
            msg.SendMessage(new SuperMetadata());
        }
コード例 #7
0
        public void ssl_defaul_strictness_settings_are_set_to_strict()
        {
            _config = new MessagingBaseConfiguration()
                      .WithDefaults()
                      .UsesSecureConnections() // default
                      .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings())
                      .WithRabbitManagement("localhost", 0, "", "", "/", "");

            var firstInstance  = (RabbitMqQuery)_config.GetManagement();
            var secondInstance = (RabbitMqQuery)_config.GetManagement();

            Assert.That(firstInstance?.AcceptInvalidSsl, Is.False, "First instance was relaxed, but expected strict");
            Assert.That(secondInstance?.AcceptInvalidSsl, Is.False, "First instance was relaxed, but expected strict");
        }
コード例 #8
0
        public void ssl_relaxed_strictness_settings_are_persistent()
        {
            _config = new MessagingBaseConfiguration()
                      .WithDefaults()
                      .UsesSecureConnections(SslConnectionStrictness.Relaxed)
                      .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings())
                      .WithRabbitManagement("localhost", 0, "", "", "/", "");


            var firstInstance  = (RabbitMqQuery)(_config.GetManagement());
            var secondInstance = (RabbitMqQuery)(_config.GetManagement());

            Assert.That(firstInstance?.AcceptInvalidSsl, Is.True, "First instance was strict, but expected relaxed");
            Assert.That(secondInstance?.AcceptInvalidSsl, Is.True, "First instance was strict, but expected relaxed");
        }
コード例 #9
0
        public void A_configured_messaging_base()
        {
            messaging = new MessagingBaseConfiguration()
                        .WithDefaults()
                        //.WithContractRoot<...some type...>()  // by omitting this, we force the system to discover types itself.
                        .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings())
                        .GetMessagingBase();

            testMessage = new SuperMetadata
            {
                CorrelationId = Guid.NewGuid(),
                Contents      = "These are my ||\"\\' ' contents: ⰊⰄⰷἚ𐰕𐰑ꔘⶤعبػػ↴↳↲↰",
                FilePath      = @"C:\temp\",
                HashValue     = 893476,
                MetadataName  = "KeyValuePair"
            };
        }
コード例 #10
0
        public void A_configured_messaging_base()
        {
            messaging = new MessagingBaseConfiguration()
                        .WithDefaults()
                        .WithContractRoot <IMsg>()
                        .WithConnection(ConfigurationHelpers.RabbitMqConnectionWithConfigSettings())
                        .WithApplicationGroupName("app-group-name")
                        .GetMessagingBase();

            testMessage = new SuperMetadata
            {
                CorrelationId = Guid.NewGuid(),
                Contents      = "This is my message",
                FilePath      = @"C:\temp\",
                HashValue     = 893476,
                MetadataName  = "KeyValuePair"
            };
        }