Example #1
0
        private static ThingsWorker RegisterIngestionTopicReceiver(ThingsWorker thingsWorker,
                                                                   string serviceNamespace,
                                                                   string serviceOwner, string serviceOwnerSecret,
                                                                   string storageWriterConnection)
        {
            if (thingsWorker != null)
            {
                thingsWorker.UnregisterReceiver();
            }
            else
            {
                thingsWorker = new ThingsWorker(storageWriterConnection,
                                                serviceNamespace,
                                                serviceOwner,
                                                serviceOwnerSecret);
            }

            thingsWorker.RegisterReceiver();
            return(thingsWorker);
        }
Example #2
0
        private static void ChooseActivePartition(int partitionAreaLength, ref int activePartition, ref ThingsWorker thingsWorker)
        {
            int tempPartition;

            Console.Write("Active Partition: ");
            tempPartition = int.Parse(Console.ReadLine());

            if (tempPartition < 0 || tempPartition >= partitionAreaLength)
            {
                Console.WriteLine("Value ignored!");
            }
            else
            {
                if (thingsWorker != null)
                {
                    thingsWorker.UnregisterReceiver();
                    thingsWorker.Dispose();
                    thingsWorker = null;
                }

                activePartition = tempPartition;
            }
        }