Пример #1
0
        protected override void OnHandler(ParameterHandlerInfo info)
        {
            Core.Log.Warning("Starting Redis Test");

            #region Set Config
            var mqConfig = new MQPairConfig
            {
                Name  = "QueueTest",
                Types = new MQObjectTypes {
                    ClientType = typeof(RedisQueueClient), ServerType = typeof(RedisQueueServer)
                },
                RawTypes = new MQObjectTypes {
                    ClientType = typeof(RedisQueueRawClient), ServerType = typeof(RedisQueueRawServer)
                },
                ClientQueues = new List <MQClientQueues>
                {
                    new MQClientQueues
                    {
                        EnvironmentName = "",
                        MachineName     = "",
                        SendQueues      = new List <MQConnection> {
                            new MQConnection("localhost", "TEST_RQ", null)
                        },
                        RecvQueue = new MQConnection("localhost", "TEST_RS", null)
                    }
                },
                ServerQueues = new List <MQServerQueues>
                {
                    new MQServerQueues
                    {
                        EnvironmentName = "",
                        MachineName     = "",
                        RecvQueues      = new List <MQConnection> {
                            new MQConnection("localhost", "TEST_RQ", null)
                        }
                    }
                },
                RequestOptions = new MQRequestOptions
                {
                    SerializerMimeType = SerializerManager.DefaultBinarySerializer.MimeTypes[0],
                    //CompressorEncodingType = "gzip",
                    ClientSenderOptions = new MQClientSenderOptions
                    {
                        Label = "TEST REQUEST",
                        MessageExpirationInSec = 30,
                        MessagePriority        = MQMessagePriority.Normal,
                        Recoverable            = false
                    },
                    ServerReceiverOptions = new MQServerReceiverOptions
                    {
                        MaxSimultaneousMessagesPerQueue = 20000,
                        ProcessingWaitOnFinalizeInSec   = 10,
                        SleepOnExceptionInSec           = 1000
                    }
                },
                ResponseOptions = new MQResponseOptions
                {
                    SerializerMimeType = SerializerManager.DefaultBinarySerializer.MimeTypes[0],
                    //CompressorEncodingType = "gzip",
                    ClientReceiverOptions = new MQClientReceiverOptions(60,
                                                                        new KeyValue <string, string>("SingleResponseQueue", "true")
                                                                        ),
                    ServerSenderOptions = new MQServerSenderOptions
                    {
                        Label = "TEST RESPONSE",
                        MessageExpirationInSec = 30,
                        MessagePriority        = MQMessagePriority.Normal,
                        Recoverable            = false
                    }
                }
            };
            #endregion

            JsonTextSerializerExtensions.Serializer.Indent = true;

            mqConfig.SerializeToXmlFile("redisConfig.xml");
            mqConfig.SerializeToJsonFile("redisConfig.json");

            var manager = mqConfig.GetQueueManager();
            manager.CreateClientQueues();

            //Core.DebugMode = true;
            //Core.Log.MaxLogLevel = Diagnostics.Log.LogLevel.InfoDetail;

            Core.Log.Warning("Starting with Normal Listener and Client");
            NormalTest(mqConfig);
            mqConfig.ResponseOptions.ClientReceiverOptions.Parameters["SingleResponseQueue"] = "true";
            Core.Log.Warning("Starting with RAW Listener and Client");
            RawTest(mqConfig);
        }
Пример #2
0
        protected override void OnHandler(ParameterHandlerInfo info)
        {
            Core.Log.Warning("Starting RabbitMQ Test");

            #region Set Config
            var mqConfig = new MQPairConfig
            {
                Name  = "QueueTest",
                Types = new MQObjectTypes {
                    ClientType = typeof(RabbitMQueueClient), ServerType = typeof(RabbitMQueueServer), AdminType = typeof(RabbitMQueueAdmin)
                },
                RawTypes = new MQObjectTypes {
                    ClientType = typeof(RabbitMQueueRawClient), ServerType = typeof(RabbitMQueueRawServer), AdminType = typeof(RabbitMQueueAdmin)
                },
                ClientQueues = new List <MQClientQueues>
                {
                    new MQClientQueues
                    {
                        EnvironmentName = "",
                        MachineName     = "",
                        SendQueues      = new List <MQConnection> {
                            new MQConnection("amqp://*****:*****@127.0.0.1:5672/", "TEST_RQ", null)
                        },
                        RecvQueue = new MQConnection("amqp://*****:*****@127.0.0.1:5672/", "TEST_RS", null)
                    }
                },
                ServerQueues = new List <MQServerQueues>
                {
                    new MQServerQueues
                    {
                        EnvironmentName = "",
                        MachineName     = "",
                        RecvQueues      = new List <MQConnection> {
                            new MQConnection("amqp://*****:*****@127.0.0.1:5672/", "TEST_RQ", null)
                        }
                    }
                },
                RequestOptions = new MQRequestOptions
                {
                    SerializerMimeType = SerializerManager.DefaultBinarySerializer.MimeTypes[0],
                    //CompressorEncodingType = "gzip",
                    ClientSenderOptions = new MQClientSenderOptions
                    {
                        Label = "TEST REQUEST",
                        MessageExpirationInSec = 30,
                        MessagePriority        = MQMessagePriority.Normal,
                        Recoverable            = false
                    },
                    ServerReceiverOptions = new MQServerReceiverOptions
                    {
                        MaxSimultaneousMessagesPerQueue = 2000,
                        ProcessingWaitOnFinalizeInSec   = 10,
                        SleepOnExceptionInSec           = 1000
                    }
                },
                ResponseOptions = new MQResponseOptions
                {
                    SerializerMimeType = SerializerManager.DefaultBinarySerializer.MimeTypes[0],
                    //CompressorEncodingType = "gzip",
                    ClientReceiverOptions = new MQClientReceiverOptions(60,
                                                                        new KeyValue <string, string>("SingleResponseQueue", "true")
                                                                        ),
                    ServerSenderOptions = new MQServerSenderOptions
                    {
                        Label = "TEST RESPONSE",
                        MessageExpirationInSec = 30,
                        MessagePriority        = MQMessagePriority.Normal,
                        Recoverable            = false
                    }
                }
            };
            #endregion

            var manager = mqConfig.GetQueueManager();
            manager.CreateClientQueues();

            Core.Log.Warning("Starting with RAW Listener and Client");
            RawTest(mqConfig);
        }