Exemple #1
0
        public void Start()
        {
            _connector.AddHost("tmq://localhost:48050");

            _connector.Connected       += Connected;
            _connector.MessageReceived += MessageReceived;
            _connector.Run();

            _timer = new Timer(o =>
            {
                if (_connector.IsConnected)
                {
                    TmqClient client = _connector.GetClient();

                    ProducerEvent e = new ProducerEvent();
                    e.No            = _eventCount;
                    e.Guid          = Guid.NewGuid().ToString();
                    e.Name          = "Producer Event";

                    Console.WriteLine($"Sending package #{e.No}");
                    _eventCount++;

                    client.PushJson("BasicChannel", ModelTypes.ProducerEvent, e, false);
                    client.PushJson("AckChannel", ModelTypes.ProducerEvent, e, false);
                }
            }, null, 1000, 1000);
        }