static void InitializeECommon() { _message = new byte[int.Parse(ConfigurationManager.AppSettings["MessageSize"])]; _mode = ConfigurationManager.AppSettings["Mode"]; _messageCount = int.Parse(ConfigurationManager.AppSettings["MessageCount"]); var logContextText = "mode: " + _mode; ECommonConfiguration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .RegisterUnhandledExceptionHandler(); _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(typeof(Program).Name); _performanceService = ObjectContainer.Resolve<IPerformanceService>(); var setting = new PerformanceServiceSetting { AutoLogging = false, StatIntervalSeconds = 1, PerformanceInfoHandler = x => { _logger.InfoFormat("{0}, {1}, totalCount: {2}, throughput: {3}, averageThrughput: {4}, rt: {5:F3}ms, averageRT: {6:F3}ms", _performanceService.Name, logContextText, x.TotalCount, x.Throughput, x.AverageThroughput, x.RT, x.AverageRT); } }; _performanceService.Initialize(_performanceKey, setting); _performanceService.Start(); }
public HttpReportsBackgroundService(IOptions <HttpReportsOptions> options, IConfiguration configuration, ILogger <HttpReportsBackgroundService> logger, IHttpContextAccessor contextAccessor, IHttpReportsStorage storage, IPerformanceService performanceService) { _logger = logger; _performanceService = performanceService; _storage = storage; _config = configuration; _options = options?.Value; }
public static RealTimeInventoryFinalResult ProcessAndSendResult( this OperationResult <IRealTimeInventory> result , IRequestMessage requestMessage , Func <IRealTimeInventory, IInventoryServiceCompletedMessage> successResponseCompletedMessage , IRealTimeInventory realTimeInventory , IActorRef notificationActorRef, IPerformanceService performanceService) { return(result.ProcessAndSendResult(requestMessage, successResponseCompletedMessage, null, realTimeInventory, null, notificationActorRef, performanceService)); }
public PushHandleService(ILogger <MessageHandleService> logger, IServiceProvider serviceProvider, IOptions <PushHandleOption> options, IPerformanceService performanceService, IFluentSocketFactory fluentSocketFactory) { _logger = logger; _serviceProvider = serviceProvider; _option = options.Value; _performanceService = performanceService; _fluentSocketFactory = fluentSocketFactory; _cts = new CancellationTokenSource(); }
public PerformanceNotificationModel(IMessageHandler messageHandler) : base() { if (messageHandler == null) { throw new ArgumentException("Message handler must not be null"); } this.messageHandler = messageHandler; performanceService = ServiceFactory.CreatePerformanceService(); SendCommand = new RelayCommand(p => Send(p), p => IsViewModelValid); }
public AdministrationService( IPerformanceService performanceService, ISpeechService speechService, IAudioService audioService, ILanguageService languageService, IMapper mapper) { _performanceService = performanceService; _speechService = speechService; _audioService = audioService; _languageService = languageService; _mapper = mapper; }
public void StartServer(IPerformanceService performanceService, IBackUpService backUpService, Action <IActorRef, ActorSystem> onReady = null, Type storageType = null, string serverActorSystemName = null, ActorSystem serverActorSystem = null, string serverActorSystemConfig = null) { Log.Debug("Initializing ..."); IActorRef inventoryActor = null; if (storageType == null) { // var message = "Unable to initialize storage. No storage specified" ; // Log.Debug(message); var storageSettings = ConfigurationManager.AppSettings["Storage"]; if (string.IsNullOrEmpty(storageSettings)) { const string message = "Could not find Storage setup in config"; Log.Debug(message); throw new Exception(message); } else { storageType = Type.GetType(storageSettings); } } if (storageType == null) { const string message = "Could not create storage type"; Log.Debug(message); throw new Exception(message); } var inventoryStorage = (IInventoryStorage)Activator.CreateInstance(storageType); Log.Debug("Starting Server"); ActorSystemFactory.CreateOrSetUpActorSystem(serverActorSystemName: serverActorSystemName, actorSystem: serverActorSystem, actorSystemConfig: serverActorSystemConfig); inventoryActor = ActorSystemFactory.InventoryServiceActorSystem.ActorOf( Props.Create(() => new InventoryActor(inventoryStorage, performanceService, backUpService, true)), typeof(InventoryActor).Name); if (inventoryActor == null || inventoryActor.IsNobody()) { const string message = "Unable to create actor"; Log.Debug(message); throw new Exception(message); } ActorSystem = ActorSystemFactory.InventoryServiceActorSystem; onReady?.Invoke(inventoryActor, ActorSystem); }
public RequestHandler() { _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName); _performanceService = ObjectContainer.Resolve<IPerformanceService>(); var setting = new PerformanceServiceSetting { AutoLogging = false, StatIntervalSeconds = 1, PerformanceInfoHandler = x => { _logger.InfoFormat("{0}, totalCount: {1}, throughput: {2}, averageThrughput: {3}, rt: {4:F3}ms, averageRT: {5:F3}ms", _performanceService.Name, x.TotalCount, x.Throughput, x.AverageThroughput, x.RT, x.AverageRT); } }; _performanceService.Initialize(_performanceKey, setting); _performanceService.Start(); }
public InventoryServiceServer(IPerformanceService performanceService, IBackUpService backUpService, InventoryServerOptions options = null) { Options = options ?? new InventoryServerOptions(); if (Options.DontUseActorSystem) { DontUseActorSystem = Options.DontUseActorSystem; TestInventoryStorage = Options.StorageType != null ? (IInventoryStorage)Activator.CreateInstance(Options.StorageType) : new Storage.InMemoryLib.InMemory(); if (Options.InitialInventory != null) { TestInventoryStorage.WriteInventoryAsync(Options.InitialInventory); } } else { Sys = Options.ClientActorSystem; InventoryServiceApplication = new InventoryServiceApplication(); if (string.IsNullOrEmpty(Options.InventoryActorAddress)) { Options.InventoryActorAddress = ConfigurationManager.AppSettings["RemoteInventoryActorAddress"]; } InventoryServiceApplication.Start(performanceService, backUpService, Options.OnInventoryActorSystemReady, Options.StorageType, serverEndPoint: Options.ServerEndPoint, serverActorSystemName: Options.ServerActorSystemName, serverActorSystem: Options.ServerActorSystem, serverActorSystemConfig: Options.ServerActorSystemConfig); Sys = Sys ?? InventoryServiceApplication.InventoryServiceServerApp.ActorSystem; var selection = Sys.ActorSelection(Options.InventoryActorAddress); inventoryActor = TryResolveActorSelection(selection); var serverEndPoint = Options.ServerEndPoint;//ConfigurationManager.AppSettings["ServerEndPoint"]; if (!string.IsNullOrEmpty(serverEndPoint)) { OwinRef = WebApp.Start <Startup>(url: serverEndPoint); } if (Options.InitialInventory != null) { InitializeWithInventorydata(Options); } } }
static void Main(string[] args) { var configuration = Configuration .Create() .UseAutofac() .RegisterCommonComponents() .UseLog4Net() .UseJsonNet() .RegisterUnhandledExceptionHandler(); _performanceService = ObjectContainer.Resolve <IPerformanceService>(); _performanceService.Initialize(_performanceKey); _performanceService.Start(); AppendEventTest(); Console.ReadLine(); }
public void Startup() { pdao = new PerformanceDao(db); adoa = new ArtistDao(db); countrydao = new CountryDao(db); categorydao = new CategoryDao(db); vdao = new VenueDao(db); ps = ServiceFactory.CreatePerformanceService(db); pdao.DeleteAllPerformances(); adoa.DeleteAllArtists(); countrydao.DeleteAllCountries(); categorydao.DeleteAllCategories(); vdao.DeleteAllVenues(); }
public static RealTimeInventoryFinalResult ProcessAndSendResult(this OperationResult <IRealTimeInventory> result, IRequestMessage requestMessage, Func <IRealTimeInventory, IInventoryServiceCompletedMessage> successResponseCompletedMessage, ILoggingAdapter logger, IRealTimeInventory realTimeInventory, IActorRef sender, IActorRef notificationActorRef, IPerformanceService performanceService) { logger?.Info(requestMessage.GetType().Name + " Request was " + (!result.IsSuccessful ? " NOT " : "") + " successful. Current Inventory : " + realTimeInventory.GetCurrentQuantitiesReport()); IInventoryServiceCompletedMessage response; if (!result.IsSuccessful) { response = result.ToInventoryOperationErrorMessage(requestMessage.ProductId); var message = "Error while trying to " + requestMessage.GetType() + " - The sender of the message is " + sender?.Path + result.Exception.ErrorMessage; notificationActorRef?.Tell(message); logger?.Error(message, requestMessage, result, realTimeInventory.GetCurrentQuantitiesReport()); } else { realTimeInventory = result.Data as RealTimeInventory; response = successResponseCompletedMessage(realTimeInventory); logger?.Info(response.GetType().Name + " Response was sent back. Current Inventory : " + realTimeInventory.GetCurrentQuantitiesReport() + " - The sender of the message is " + sender.Path); } sender?.Tell(response); notificationActorRef?.Tell(new RealTimeInventoryChangeMessage(realTimeInventory)); performanceService?.Increment("Completed " + requestMessage.GetType().Name); return(new RealTimeInventoryFinalResult(realTimeInventory as RealTimeInventory, response, result)); }
public HttpReportsBackgroundService(ILogger <HttpReportsBackgroundService> logger, IHttpContextAccessor contextAccessor, IHttpReportsStorage storage, IPerformanceService performanceService) { _logger = logger; _performanceService = performanceService; _storage = storage; }
public PerformanceManagementViewModel(IPerformanceService performanceService, IArtistService artistService, IVenueService venueService) { this.performanceService = performanceService; this.artistService = artistService; this.venueService = venueService; PerformancesForDay = new ObservableCollection<PerformanceViewModel>(); Venues = new ObservableCollection<Venue>(); Artists = new ObservableCollection<Artist>(); CurrentDay = new DisplayDateTime(DateTime.Now); UpdatePerformancesForDay(); UpdateVenues(); UpdateArtists(); DateTime now = DateTime.Now; timeInput = new DateTime(now.Year, now.Month, now.Day, now.Hour, 0, 0); if(Venues.Count > 0) { VenueInput = Venues[0]; } if(Artists.Count > 0) { ArtistInput = Artists[0]; } CurrentDay.PropertyChanged += CurrentDay_PropertyChanged; }
public ResponseHandler(IPerformanceService performanceService, string performanceKey) { _performanceService = performanceService; _performanceKey = performanceKey; }