예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Subscriber");

            string topic;

            Console.WriteLine("Enter the topic");
            topic = Console.ReadLine().ToLower();

            var subscriberSocket = new SubscriberSocket(topic);

            subscriberSocket.Connect(Settings.BROKER_IP, Settings.BROKER_PORT);

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Subscriber");

            string bankName;

            Console.Write("Enter the bank you want to subscribe: ");
            bankName = Console.ReadLine().ToLower();

            var subscriberSocket = new SubscriberSocket(bankName);

            subscriberSocket.Connect(Settings.BROKER_IP, Settings.BROKER_PORT);

            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("It's me Subsriber");

            string topic;

            Console.Write("What is the Topic: ");
            topic = Console.ReadLine().ToLower();

            var subscriberSocket = new SubscriberSocket(topic);

            subscriberSocket.Connect(Settings.BROKER_IP, Settings.BROKER_PORT);

            Console.WriteLine("To exit press any key");
            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            string topic = args[0] == "All" ? "" : args[0];

            Console.WriteLine("Subscriber started for Topic : {0}", topic);

            using (var subSocket = new SubscriberSocket())
            {
                subSocket.Options.ReceiveHighWatermark = 1000;
                subSocket.Connect("tcp://localhost:12345");
                subSocket.Subscribe(topic);
                Console.WriteLine("Subscriber socket connecting...");
                while (true)
                {
                    string messageTopicReceived = subSocket.ReceiveFrameString();
                    string messageReceived      = subSocket.ReceiveFrameString();
                    Console.WriteLine(messageReceived);
                }
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            // 구독 주제 설정
            if (args.Length != 1 || !allowableCommandLineArgs.Contains(args[0]))
            {
                Console.WriteLine("Expected one argument, either " + "'TopicA', 'TopicB' or 'All'");
                Environment.Exit(-1);
            }

            // 구독 주제 입력
            string topic = args[0] == "All" ? "" : args[0];

            Console.WriteLine($"Subscriber started for Topic : {topic}");

            // 소켓 오픈
            using (var subSocket = new SubscriberSocket())
            {
                // 미해결 메시지 제한
                subSocket.Options.ReceiveHighWatermark = 1000;

                // 소켓 오픈
                subSocket.Connect("tcp://localhost:12345");

                // 주제 구독
                subSocket.Subscribe(topic);

                // 메시지 처리
                Console.WriteLine("Subscriber socket connecting...");
                while (true)
                {
                    string messageTopicReceived = subSocket.ReceiveFrameString();
                    string messageReceived      = subSocket.ReceiveFrameString();
                    Console.WriteLine(messageReceived);
                }
            }
        }