Example #1
0
        public void Notify(string prekidac)
        {
            Trace.WriteLine(prekidac);
            string[] parts = prekidac.Split(':');
            Prekidac p     = new Prekidac(parts[0], parts[1]);

            tableHelper.AddOrReplacePrekidac(p);
        }
Example #2
0
        private async Task RunAsync(CancellationToken cancellationToken)
        {
            // TODO: Replace the following with your own logic.
            while (!cancellationToken.IsCancellationRequested)
            {
                Trace.WriteLine("--------------------------------");
                if (id == "0")
                {
                    string msg = queueHelper.GetFromQueue();

                    if (msg == null)
                    {
                        Trace.WriteLine("Nema poruke");
                    }
                    else
                    {
                        if (msg.Split(':')[1] == "zatvoreno")
                        {
                            Trace.WriteLine(msg);
                            string[] parts = msg.Split(':');
                            Prekidac p     = new Prekidac(parts[0], parts[1]);

                            tableHelper.AddOrReplacePrekidac(p);
                        }
                        else
                        {
                            Trace.WriteLine("Send To Instance1");
                            proxy.Notify(msg);
                        }
                    }
                }


                Trace.TraceInformation("Working");
                Trace.WriteLine("--------------------------------");
                await Task.Delay(3000);
            }
        }