Ejemplo n.º 1
0
        public void CarWashConsumer()
        {
            string defaultDeviceName        = Environment.MachineName;
            string defaultDeviceDescription =
                $".net wrapper unit test.  Class: {this.GetType().Name}.  Method: {System.Reflection.MethodBase.GetCurrentMethod().Name}";

            ThriftClient.SetupDevice(defaultDeviceName, defaultDeviceDescription);
            foreach (ServiceMessage service in ThriftClient.DeviceDiscovery(20000))
            {
                Log.InfoFormat("Found service: ", service);
            }
        }
Ejemplo n.º 2
0
        public void SendSimpleMessage()
        {
            ThriftClient.SetupDevice("DotNet RPC client", "This is coming from C# via Thrift RPC.");
            Log.Info("Initialising Producer");
            ThriftClient.InitProducer("cl_key", "srv_key");
            ThriftClient.StartServiceBroadcast(2000);
            var svcMsgs = ThriftClient.DeviceDiscovery(2000);

            if (svcMsgs != null)
            {
                foreach (ServiceMessage svcMsg in svcMsgs)
                {
                    Log.InfoFormat("{0} - {1} - {2} - {3}", svcMsg.DeviceDescription, svcMsg.Hostname, svcMsg.PortNumber,
                                   svcMsg.ServerId);
                }
            }
            else
            {
                Log.Info("Broadcast ok, but no services found");
            }
            Log.Info("All done, closing transport");
        }