Beispiel #1
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     messagingService.ReceiveScatterGatherMessageThree(model);
 }
Beispiel #2
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     messagingService.ReceivePublishSubscribeMessageReceiverTwo(model);
 }
Beispiel #3
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     messagingService.ReceiveRoutingMessageReceiverOne(model);
 }
Beispiel #4
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     messagingService.ReceiveWorkerQueueMessages(model);
 }
Beispiel #5
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     //messagingService.SetUpExchangeAndQueuesForScatterGatherDemo(model);
     RunScatterGatherDemo(model, messagingService);
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     AmqpMessagingService messagingService = new AmqpMessagingService();
     IConnection connection = messagingService.GetRabbitMqConnection();
     IModel model = connection.CreateModel();
     //messagingService.SetUpQueueForWorkerQueueDemo(model);
     RunWorkerQueueMessageDemo(model, messagingService);
 }
Beispiel #7
0
        private static void RunOneWayMessageDemo(IModel model, AmqpMessagingService messagingService)
        {
            Console.WriteLine("Enter your message and press Enter. Quit with 'q'.");
            while (true)
            {
                string message = Console.ReadLine();
                if (message.ToLower() == "q") break;

                messagingService.SendOneWayMessage(message, model);
            }
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            AmqpMessagingService messagingService = new AmqpMessagingService();
            IConnection connection = messagingService.GetRabbitMqConnection();
            IModel model = connection.CreateModel();
            messagingService.SetUpQueueForOneWayMessageDemo(model);

            RunOneWayMessageDemo(model, messagingService);

            Console.ReadKey();
        }
Beispiel #9
0
        private static void RunRpcMessageDemo(IModel model, AmqpMessagingService messagingService)
        {
            Console.WriteLine("Enter your message and press Enter. Quit with 'q'.");
            while (true)
            {
                string message = Console.ReadLine();
                if (message.ToLower() == "q") break;

                String response = messagingService.SendRpcMessageToQueue(message, model, TimeSpan.FromMinutes(1));
                Console.WriteLine("Response: {0}", response);
            }
        }
Beispiel #10
0
 private static void RunTopicsDemo(IModel model, AmqpMessagingService messagingService)
 {
     Console.WriteLine("Enter your message as follows: the routing key, followed by a semicolon, and then the message. Quit with 'q'.");
     while (true)
     {
         string fullEntry = Console.ReadLine();
         string[] parts = fullEntry.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         string key = parts[0];
         string message = parts[1];
         if (message.ToLower() == "q") break;
         messagingService.SendTopicsMessage(message, key, model);
     }
 }
Beispiel #11
0
 private static void RunHeadersDemo(IModel model, AmqpMessagingService messagingService)
 {
     Console.WriteLine("Enter your message as follows: the header values for 'category' and 'type separated by a colon. Then put a semicolon, and then the message. Quit with 'q'.");
     while (true)
     {
         string fullEntry = Console.ReadLine();
         string[] parts = fullEntry.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         string headers = parts[0];
         string[] headerValues = headers.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         Dictionary<string, object> headersDictionary = new Dictionary<string, object>();
         headersDictionary.Add("category", headerValues[0]);
         headersDictionary.Add("type", headerValues[1]);
         string message = parts[1];
         if (message.ToLower() == "q") break;
         messagingService.SendHeadersMessage(message, headersDictionary, model);
     }
 }
Beispiel #12
0
 private static void RunScatterGatherDemo(IModel model, AmqpMessagingService messagingService)
 {
     Console.WriteLine("Enter your message as follows: the routing key, followed by a semicolon, and then the message. Quit with 'q'.");
     while (true)
     {
         string fullEntry = Console.ReadLine();
         string[] parts = fullEntry.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         string key = parts[0];
         string message = parts[1];
         if (message.ToLower() == "q") break;
         //method needs model, routing key, timeout, message
         List<string> responses = messagingService.SendScatterGatherMessageToQueues(message, model, TimeSpan.FromSeconds(20), key, 3);
         Console.WriteLine("Received the following messages: ");
         foreach (string response in responses)
         {
             Console.WriteLine(response);
         }
     }
 }