Example #1
0
        public static void Test_ZeroMqFaf_Receive()
        {
            try
            {
                Console.WriteLine();
                Console.WriteLine("ZeroMq test inbound messages [work time per message {0}ms].", workTimeInMs);

                // Creating queue object from factory.
                // NOTE: it should only be disposed when exiting the program. Otherwise, it will not receive messages.
                inboundMessageQueue = MessagingQueueFactory.CreateInboundFaF <string>(new AppSettingsConfigurationProvider(), "ZeroMqFaFInbound", new NQueueLogger("Default"));
                inboundMessageQueue.OnMessageReady += ZeroMqInboundMessageQueue_OnMessageReady;
                //inboundMessageQueue.OnMessageReadyAsync += ZeroMqInboundMessageQueue_OnMessageReadyAsync;

                // Ready to start.
                Console.WriteLine("Press any key to start receiving...");
                Console.ReadKey();

                // Checking is there any message.
                Console.WriteLine("Queue has message: {0}", inboundMessageQueue.HasMessage());

                // Starting.
                inboundMessageQueue.StartReceivingMessage();

                Console.WriteLine("Started....");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #2
0
        public static void Test_ServiceBusFaF_Receive()
        {
            try
            {
                Console.WriteLine("ServiceBus test inbound messages [work time per message {0}ms].", workTimeInMs);

                // Creating queue object from factory.
                inboundMessageQueue = MessagingQueueFactory.CreateInboundFaF <string>(new AppSettingsConfigurationProvider(), "ServiceBusFaFInbound", new NQueueLogger("Default"));
                //inboundMessageQueue.OnMessageReadyAsync += ServiceBusInboundMessageQueue_OnMessageReadyAsync;
                inboundMessageQueue.OnMessageReady += ServiceBusInboundMessageQueue_OnMessageReady;

                // Ready to start.
                Console.WriteLine("Press any key to start receiving...");
                Console.ReadKey();

                // Checking is there any message.
                Console.WriteLine("Queue has message: {0}", inboundMessageQueue.HasMessage());

                // Starting.
                inboundMessageQueue.StartReceivingMessage();

                Console.WriteLine("Started....");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }