public void ProcessMessage(IBackgroundTask task) { if (task != null) { _logger.InfoFormat("Received MSMQ message: {0}", task.ToJson()); switch (task.TaskType) { case Constants.MessageActionType.UpdatedUserDefinedUnit: ProcessUduUpdate(task); break; case Constants.MessageActionType.UpdatedProductSet: ProcessProductSetUpdate(task); break; case Constants.MessageActionType.UpdatedPriceBand: ProcessPriceBandUpdate(task); break; case Constants.MessageActionType.UpdatedGroup: ProcessGroupUpdate(task); //extend processing to orchestration task.TaskType = Constants.MessageActionType.StarChefEventsUpdated; task.EntityType = Constants.EntityType.Group; task.ProductId = task.GroupId; ProcessStarChefEventsUpdated(task); break; case Constants.MessageActionType.UpdatedProductCost: ProcessProductCostUpdate(task); break; case Constants.MessageActionType.GlobalUpdate: ProcessGlobalUpdate(task); break; case Constants.MessageActionType.UpdatedProductNutrient: ProcessProductNutrientUpdate(task); //extend processing to orchestration task.TaskType = Constants.MessageActionType.UpdatedProductNutrient; if (task.EntityType == Constants.EntityType.Dish || task.EntityType == Constants.EntityType.Ingredient) { if (task.EntityType == Constants.EntityType.Dish) { ProcessStarChefEventsUpdated(task); } this.AddOrchestrationMessageForAffectedRecipes(task.ProductId, _connectionString); } else if ((int)task.EntityType == 0) { task.EntityType = Constants.EntityType.Dish; ProcessStarChefEventsUpdated(task); } break; case Constants.MessageActionType.UpdatedProductIntolerance: ProcessProductIntoleranceUpdate(task); break; case Constants.MessageActionType.UpdatedProductNutrientInclusive: ProcessProductNutrientInclusiveUpdate(task); break; case Constants.MessageActionType.GlobalUpdateBudgeted: ProcessGlobalUpdateBudgeted(task); break; case Constants.MessageActionType.UpdateAlternateIngredients: ProcessAlternateIngredientUpdate(task); break; // All Events are populating under StarChefEventsUpdated Action - Additional action added for // User because of multiple different actions case Constants.MessageActionType.StarChefEventsUpdated: // Starchef to Salesforce - later Salesforce notify to Starchef the user created notification case Constants.MessageActionType.UserCreated: case Constants.MessageActionType.UserUpdated: case Constants.MessageActionType.UserActivated: // Once user created in Salesforce, SF will notified and to SC and SC store the external id on DB case Constants.MessageActionType.SalesForceUserCreated: _logger.Debug("enter StarChefEventsUpdated"); ProcessStarChefEventsUpdated(task); _logger.Debug("exit StarChefEventsUpdated"); break; case Constants.MessageActionType.EntityImported: PostProcessingPerSubAction(task); break; case Constants.MessageActionType.UpdatedInventoryValidation: ProcessUpdatedInventoryValidation(_connectionString); break; case Constants.MessageActionType.UpdatedProductABV: ProcessProductAbvUpdate(_connectionString, task.ProductId, task.TrackId, task.UserId); break; case Constants.MessageActionType.EnabledAbv: ProcessFullAbvIngredientRecalculation(_connectionString, task.UserId); break; case Constants.MessageActionType.UpdateAlternatesRank: ProcessRankReorder(_connectionString, task.ExtendedProperties); break; case Constants.MessageActionType.UpdatedProductFIR: ProcessProductFIRUpdate(_connectionString, task.ProductId, task.TrackId, task.UserId); break; case Constants.MessageActionType.EnabledFIR: ProcessFullFIRIngredientRecalculation(_connectionString, task.UserId); break; } } }