private void StartQueues() { DebugLog.Log(String.Format("*********************************\nTrying to start queues at {0}", DateTime.Now.ToString())); DebugLog.Log(String.Format("Is josh? {0}", Environment.GetEnvironmentVariable("ISJOSH"))); String connectionString = null; String queueName = null; String protectedQueueConnectionString = null; String protectedQueueName = null; if (String.Compare(Environment.GetEnvironmentVariable("ISJOSH"), "Ayup") == 0) { connectionString = RoleEnvironment.GetConfigurationSettingValue("DevQueueConnectionString"); queueName = RoleEnvironment.GetConfigurationSettingValue("DevQueueName"); protectedQueueConnectionString = RoleEnvironment.GetConfigurationSettingValue("DevProtectedQueueConnectionString"); protectedQueueName = RoleEnvironment.GetConfigurationSettingValue("DevProtectedQueueName"); } else { connectionString = RoleEnvironment.GetConfigurationSettingValue(this.connectionStringKey); queueName = RoleEnvironment.GetConfigurationSettingValue(this.queueNameKey); protectedQueueConnectionString = RoleEnvironment.GetConfigurationSettingValue(this.protectedQueueConnectionString); protectedQueueName = RoleEnvironment.GetConfigurationSettingValue(this.protectedQueueName); } privateQueue = new QueueHandler(connectionString, queueName); privateQueue.StartQueue(); privateQueue.StartListening(); protectedQueue = new QueueHandler(protectedQueueConnectionString, protectedQueueName); protectedQueue.StartQueue(); protectedQueue.StartListening(); DebugLog.Log(String.Format("*********************************\nFinished starting queues at {0}", DateTime.Now.ToString())); // set us up some delegates UpdateUserMessage.Del += (UpdateUserMessage msg) => { DebugLog.Log(String.Format("Got update user message from protected queue, guid: {0}", msg.guid)); }; UpdateUsersForStoreMessage.Del += (UpdateUsersForStoreMessage msg) => { UserServiceWorker worker = new UserServiceWorker(); if (worker.IsStoreCodeValid(msg.storeid)) { UpdateUsersForStoreHandler handler = new UpdateUsersForStoreHandler(); handler.storeid = msg.storeid; handler.EnqueueSelfAsMessage(privateQueue); } }; }
internal static void StartQueues() { String protectedQueueConnectionString = null; String protectedQueueName = null; if (String.Compare(Environment.GetEnvironmentVariable("ISJOSH"), "Ayup") == 0) { protectedQueueConnectionString = RoleEnvironment.GetConfigurationSettingValue("DevProtectedQueueConnectionString"); protectedQueueName = RoleEnvironment.GetConfigurationSettingValue("DevProtectedQueueName"); } else { protectedQueueConnectionString = RoleEnvironment.GetConfigurationSettingValue(PROTECTED_QUEUE_CONNECTION_STRING); protectedQueueName = RoleEnvironment.GetConfigurationSettingValue(PROTECTED_QUEUE_NAME); } BaseApiController.protectedQueue = protectedQueue = new QueueHandler(protectedQueueConnectionString, protectedQueueName); // We don't want to listen to the queue, just send messages. protectedQueue.StartQueue(); }