예제 #1
0
        static void Main(string[] args)
        {
            string connectionString = "connection string";

            connectionString = "Data Source=DESKTOP-M3DHIK5;" +
                               "Initial Catalog=WiseQueues;" +
                               "Integrated Security=SSPI;";


            ClientConfiguration clientConfiguration = new ClientConfiguration(3, TimeSpan.FromSeconds(10));
            ServerConfiguration serverConfiguration = new ServerConfiguration(3);

            using (IWiseQueueConfiguration configuration = WiseQueueGlobalConfiguration.WiseQueueConfiguration
                                                           .UseNLog()
                                                           .UseClient(clientConfiguration)
                                                           .UseServer(serverConfiguration)
                                                           .UseSqlServer(connectionString))
            {
                configuration.Activate();

                //Int64 taskId = ClientManager.StartNewTask(() => new MyClass().Test("Hello"));
                //taskId = ClientManager.StartNewTask(() => new MyClass().Test("Hello2"));

                Int64 taskId = BackgroundClient.StartNewTask(() => new MyClass().ExceptionTask());

                //Console.WriteLine("PRESS ENTER TO CANCEL");
                //Console.ReadLine();

                //ClientManager.CancelTask(taskId);

                Console.ReadLine();
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            string connectionString = "Data Source=DESKTOP-M3DHIK5;" +
                                      "Initial Catalog=WiseQueues;" +
                                      "Integrated Security=SSPI;";

            ServerConfiguration serverConfiguration = new ServerConfiguration(1000);

            using (IWiseQueueConfiguration configuration = WiseQueueGlobalConfiguration.WiseQueueConfiguration
                                                           .UseNLog()
                                                           .UseServer(serverConfiguration)
                                                           .UseSqlServer(connectionString))
            {
                configuration.Activate();

                Console.WriteLine("**** Waiting for tasks...");
                Console.ReadLine();
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            string connectionString = "Data Source=DESKTOP-M3DHIK5;" +
                                      "Initial Catalog=WiseQueues;" +
                                      "Integrated Security=SSPI;";

            string performanceConnectionString = "Data Source=DESKTOP-M3DHIK5;" +
                                                 "Initial Catalog=PerformanceTests;" +
                                                 "Integrated Security=SSPI;";

            int maxCount = 1000;

            if (args.Length > 0)
            {
                maxCount = Convert.ToInt32(args[0]);
            }

            Console.WriteLine("Maximum requests = {0}", maxCount);

            ClientConfiguration clientConfiguration = new ClientConfiguration(10, TimeSpan.FromSeconds(30));

            using (IWiseQueueConfiguration configuration = WiseQueueGlobalConfiguration.WiseQueueConfiguration
                                                           .UseNLog()
                                                           .UseClient(clientConfiguration)
                                                           //.UseServer(serverConfiguration)
                                                           .UseSqlServer(connectionString))
            {
                configuration.Activate();

                for (int i = 0; i < maxCount; i++)
                {
                    Guid requestId = Guid.NewGuid();
                    Console.WriteLine("Enqueueing requestId = {0}...", requestId);
                    Int64 taskId = BackgroundClient.StartNewTask(() => new WithExceptionServerJob().Execute(requestId, performanceConnectionString));
                    Console.WriteLine("The request has been enqueued. TaskId: {0}", taskId);
                }

                Console.WriteLine("All requests have been enqueued.");
                Console.ReadLine();
            }
        }