/// <summary> /// Initializes a new instance of the <see cref="DefaultProducerExecutionStrategy{TItem}"/> class. /// </summary> /// <param name="scopeFactory">The factory for creating service scopes.</param> /// <param name="producerFactory">The factory for creating producers.</param> /// <param name="synchronizationPolicy">The policy used to synchronize the producer and consumer engines to prevent over producing work.</param> /// <param name="alwaysExecuteOnDefaultValue">true to always execute the callback, even if the value produced is the default; otherwise false.</param> public DefaultProducerExecutionStrategy(IServiceScopeFactory scopeFactory, IProducerResolver <TItem> producerFactory, ISynchronizationPolicy synchronizationPolicy, bool alwaysExecuteOnDefaultValue) { this.scopeFactory = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory)); this.producerFactory = producerFactory ?? throw new ArgumentNullException(nameof(producerFactory)); this.synchronizationPolicy = synchronizationPolicy; this.alwaysExecuteOnDefaultValue = alwaysExecuteOnDefaultValue; }
public RedisWampWebSocketHandler(ISynchronizationPolicy syncPoly, IRoleDescriber roleDescriber) : this( ConfigurationManager.AppSettings.Get("Redis.Endpoint"), ConfigurationManager.AppSettings.Get("Redis.Key"), ConfigurationManager.AppSettings.Get("Redis.UseSsl"), syncPoly, roleDescriber ) { }
public ServiceBusWampWebSocketHandler(ISynchronizationPolicy synchronizationPolicy, IRoleDescriber roleDescriber) : base(synchronizationPolicy, roleDescriber) { namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); Subscribe += OnSubscribe; Unsubscribe += OnUnsubscribe; Publish += OnPublish; Event += OnEvent; }
protected WampWebSocketHandler(ISynchronizationPolicy synchronizationPolicy, IRoleDescriber roleDescriber) { this.roleDescriber = roleDescriber; SynchronizationPolicy = synchronizationPolicy; //Hello += OnHello; if (SynchronizationPolicy != null && SynchronizationPolicy.Synchronize) { Configure(SynchronizationPolicy.Endpoints); Subscribe += OnLocalSubscribe; Unsubscribe += OnLocalUnsubscribe; } }
public RedisWampWebSocketHandler(string endpoint, string key, string useSsl, ISynchronizationPolicy syncPoly, IRoleDescriber roleDescriber) : base(syncPoly, roleDescriber) { cache.Initialize( new Dictionary <string, string> { { "Endpoint", endpoint }, { "Key", key }, { "UseSsl", useSsl } }); cache.MessageReceived += OnMessageReceived; Subscribe += OnSubscribe; Unsubscribe += OnUnsubscribe; Publish += OnPublish; Event += OnEvent; }
public StubDefaultProducerExecutionStrategy(IServiceScopeFactory scopeFactory, IProducerResolver <TItem> producerFactory, ISynchronizationPolicy synchronizationPolicy, bool alwaysExecuteOnDefaultValue) : base( scopeFactory, producerFactory, synchronizationPolicy, alwaysExecuteOnDefaultValue) { }
private IProducerEngine <int> BuildProducerEngine(IRuntimeBuilder runtimeBuilder, ISynchronizationPolicy synchronizationPolicy) { return(new ScheduledProducerEngine <int>( new DefaultProducerExecutionStrategy <int>( runtimeBuilder.ApplicationServices.GetRequiredService <IServiceScopeFactory>(), new CallbackProducerResolver <int>( (context) => new RandomIntProducer()), synchronizationPolicy, false), new CancellationSourceFactory(), new StrategyErrorHandler( new LogToConsoleErrorStrategy(new ConsoleWriter(), LoggingLevel.All)), new PollingScheduler(TimeSpan.FromSeconds(5)), new ScheduledEngineOptions { ContinueUntilEmpty = true })); }