示例#1
0
        static void Main(string[] args)
        {
            // Attach to publisher events
            publisher.StatusMessage    += publisher_StatusMessage;
            publisher.ProcessException += publisher_ProcessException;
            publisher.ClientConnected  += publisher_ClientConnected;

            // Initialize publisher
            publisher.Name = "dataPublisher";
            publisher.UseBaseTimeOffsets            = true;
            publisher.AllowPayloadCompression       = true;
            publisher.AllowSynchronizedSubscription = true;
            publisher.Initialize();

            // Start publisher
            publisher.Start();

            ThreadPool.QueueUserWorkItem(ProcessMeasurements);

            Console.ReadLine();

            publisher.Stop();

            publisher.StatusMessage    -= publisher_StatusMessage;
            publisher.ProcessException -= publisher_ProcessException;
        }
示例#2
0
文件: Program.cs 项目: ellen50/gsf
        static void Main(string[] args)
        {
            // Attach to publisher events
            publisher.StatusMessage    += publisher_StatusMessage;
            publisher.ProcessException += publisher_ProcessException;
            publisher.ClientConnected  += publisher_ClientConnected;

            //using (AdoDataConnection database = new AdoDataConnection("systemSettings"))
            //{
            //    MeasurementKey.EstablishDefaultCache(database.Connection, database.AdapterType);

            // Initialize publisher
            //publisher.DataMember = "ActiveMeasurements";
            //publisher.DataSource = database.RetrieveDataSet("SELECT * FROM ActiveMeasurement");
            publisher.Name = "dataPublisher";
            publisher.UseBaseTimeOffsets            = true;
            publisher.AllowPayloadCompression       = true;
            publisher.AllowSynchronizedSubscription = true;
            publisher.ConnectionString = "commandChannel={port=9898}";
            //publisher.UseZeroMQChannel = true;
            //publisher.ConnectionString = "commandChannel={server=tcp://*:9898}";
            publisher.Initialize();

            // Start publisher
            publisher.Start();

            ThreadPool.QueueUserWorkItem(ProcessMeasurements);

            Console.ReadLine();

            publisher.Stop();
            //}

            publisher.StatusMessage    -= publisher_StatusMessage;
            publisher.ProcessException -= publisher_ProcessException;
        }