private static void Main(string[] args) { Console.WriteLine(); Console.WriteLine("********************************************************************************"); Console.WriteLine(); Console.WriteLine("To run this Event Consumer demo, the following is required:"); Console.WriteLine(); Console.WriteLine(" 1) The consumer.environment.url app setting in the SifFramework.config file of this Consumer needs to reference the BROKERED environment endpoint."); Console.WriteLine(" 2) The provider.environment.url app setting in the SifFramework.config file of the Sif.Framework.Demo.Au.Provider project needs to reference the BROKERED environment endpoint."); Console.WriteLine(" 3) The Sif.Framework.Demo.Broker needs to be run instead of the Sif.Framework.EnvironmentProvider."); Console.WriteLine(" 4) The Sif.Framework.Demo.Au.Provider needs to be run."); Console.WriteLine(" 5) This EventConsumerApp needs to be configured to be the Startup object for this project."); Console.WriteLine(); Console.WriteLine("********************************************************************************"); if (RunDemo("Student Personal Event Consumer")) { try { StudentPersonalEventConsumer studentPersonalConsumer = new StudentPersonalEventConsumer( SettingsManager.ConsumerSettings.ApplicationKey, SettingsManager.ConsumerSettings.InstanceId, SettingsManager.ConsumerSettings.UserToken, SettingsManager.ConsumerSettings.SolutionId, SettingsManager.ConsumerSettings); studentPersonalConsumer.Start("Sif3DemoZone1", "DEFAULT"); if (log.IsInfoEnabled) { log.Info("Started the Event Consumer."); } Console.WriteLine("Press any key to stop the Event Consumer (may take several seconds to complete) ..."); Console.ReadKey(); studentPersonalConsumer.Stop(); if (log.IsInfoEnabled) { log.Info("Stopped the Event Consumer."); } } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("Error running the Student Personal Event Consumer.\n" + ExceptionUtils.InferErrorResponseMessage(e), e); } } } Console.WriteLine("Press any key to continue ..."); Console.ReadKey(); }
public static void Main() { Console.WriteLine(); Console.WriteLine("********************************************************************************"); Console.WriteLine(); Console.WriteLine("To run this Event Consumer demo, the following steps are required."); Console.WriteLine(); Console.WriteLine(" 1) In the demo Consumer project:"); Console.WriteLine(" 1.1) Set the consumer.environment.template.applicationKey app setting to Sif3DemoEventConsumer."); Console.WriteLine(" 1.2) Configure the consumer.environment.url app setting to reference the BROKERED environment endpoint - http://localhost:59586/api/environments/environment."); Console.WriteLine(" 1.3) Configure the EventConsumerApp to be the Startup object for the project."); Console.WriteLine(); Console.WriteLine(" 2) In the demo Consumer project:"); Console.WriteLine(" 2.1) Set the provider.environmentType app setting to BROKERED."); Console.WriteLine(" 2.2) Configure the provider.environment.url app setting to reference the BROKERED environment endpoint - http://localhost:59586/api/environments/environment."); Console.WriteLine(" 2.3) This EventConsumerApp needs to be configured to be the Startup object for this project."); Console.WriteLine(); Console.WriteLine(" 3) Run the demo Broker instead of the EnvironmentProvider."); Console.WriteLine(); Console.WriteLine(" 4) Run the demo Provider."); Console.WriteLine(); Console.WriteLine(" 5) Run the demo Consumer."); Console.WriteLine(); Console.WriteLine("********************************************************************************"); try { SettingsSource source = SelectFrameworkConfigSource(); IFrameworkSettings settings = GetSettings(source); ISessionService sessionService = GetSessionService(source); var consumer = new StudentPersonalEventConsumer( settings.ApplicationKey, settings.InstanceId, settings.UserToken, settings.SolutionId, settings, sessionService); consumer.Start("Sif3DemoZone1", "DEFAULT"); if (Log.IsInfoEnabled) { Log.Info("Started the Event Consumer."); } Console.WriteLine( "Press any key to stop the Event Consumer (may take several seconds to complete) ..."); Console.ReadKey(); consumer.Stop(); if (Log.IsInfoEnabled) { Log.Info("Stopped the Event Consumer."); } } catch (Exception e) { if (Log.IsErrorEnabled) { Log.Error($"Error running the Event Consumer.\n{ExceptionUtils.InferErrorResponseMessage(e)}", e); } } Console.WriteLine("Press any key to continue ..."); Console.ReadKey(); }