protected void UseMessageBus(MessageBusType type, IDependencyResolver resolver, int streams = 1) { IMessageBus bus = null; switch (type) { case MessageBusType.Default: break; case MessageBusType.Fake: case MessageBusType.FakeMultiStream: bus = new FakeScaleoutBus(resolver, streams); break; case MessageBusType.SqlServer: break; case MessageBusType.ServiceBus: break; case MessageBusType.Redis: break; default: break; } if (bus != null) { resolver.Register(typeof(IMessageBus), () => bus); } }
protected void UseMessageBus(MessageBusType type, IDependencyResolver resolver, int streams = 1) { IMessageBus bus = null; switch (type) { case MessageBusType.Default: break; case MessageBusType.Fake: case MessageBusType.FakeMultiStream: bus = new FakeScaleoutBus(resolver, streams); break; case MessageBusType.SqlServer: break; case MessageBusType.ServiceBus: break; case MessageBusType.Redis: break; default: break; } if (bus != null) { resolver.Register(typeof(IMessageBus), () => bus); } }
public virtual void Initialize(int?keepAlive = -1, int?connectionTimeout = 110, int?disconnectTimeout = 30, int?transportConnectTimeout = 5, int?maxIncomingWebSocketMessageSize = 64 * 1024, bool enableAutoRejoiningGroups = false, MessageBusType type = MessageBusType.Default) { Resolver = Resolver ?? new DefaultDependencyResolver(); _traceManager = Resolver.Resolve <ITraceManager>(); _traceManager.Switch.Level = SourceLevels.Verbose; if (_listener != null) { foreach (var sourceName in _traceSources) { TraceSource source = _traceManager[sourceName]; source.Listeners.Add(_listener); } } var configuration = Resolver.Resolve <IConfigurationManager>(); if (connectionTimeout != null) { configuration.ConnectionTimeout = TimeSpan.FromSeconds(connectionTimeout.Value); } if (disconnectTimeout != null) { configuration.DisconnectTimeout = TimeSpan.FromSeconds(disconnectTimeout.Value); } if (transportConnectTimeout != null) { configuration.TransportConnectTimeout = TimeSpan.FromSeconds(transportConnectTimeout.Value); } configuration.MaxIncomingWebSocketMessageSize = maxIncomingWebSocketMessageSize; if (!keepAlive.HasValue) { configuration.KeepAlive = null; } // Set only if the keep-alive was changed from the default value. else if (keepAlive.Value != -1) { configuration.KeepAlive = TimeSpan.FromSeconds(keepAlive.Value); } IMessageBus bus = null; switch (type) { case MessageBusType.Default: break; case MessageBusType.Fake: bus = new FakeScaleoutBus(Resolver, streams: 1); break; case MessageBusType.FakeMultiStream: bus = new FakeScaleoutBus(Resolver, streams: 3); break; default: throw new NotImplementedException(); } if (bus != null) { Resolver.Register(typeof(IMessageBus), () => bus); } }
public virtual void Initialize(int? keepAlive = -1, int? connectionTimeout = 110, int? disconnectTimeout = 30, int? transportConnectTimeout = 5, int? maxIncomingWebSocketMessageSize = 64 * 1024, bool enableAutoRejoiningGroups = false, MessageBusType type = MessageBusType.Default) { Resolver = Resolver ?? new DefaultDependencyResolver(); _traceManager = Resolver.Resolve<ITraceManager>(); _traceManager.Switch.Level = SourceLevels.Verbose; foreach (var sourceName in _traceSources) { TraceSource source = _traceManager[sourceName]; source.Listeners.Add(_listener); } var configuration = Resolver.Resolve<IConfigurationManager>(); if (connectionTimeout != null) { configuration.ConnectionTimeout = TimeSpan.FromSeconds(connectionTimeout.Value); } if (disconnectTimeout != null) { configuration.DisconnectTimeout = TimeSpan.FromSeconds(disconnectTimeout.Value); } if (transportConnectTimeout != null) { configuration.TransportConnectTimeout = TimeSpan.FromSeconds(transportConnectTimeout.Value); } configuration.MaxIncomingWebSocketMessageSize = maxIncomingWebSocketMessageSize; if (!keepAlive.HasValue) { configuration.KeepAlive = null; } // Set only if the keep-alive was changed from the default value. else if (keepAlive.Value != -1) { configuration.KeepAlive = TimeSpan.FromSeconds(keepAlive.Value); } IMessageBus bus = null; switch (type) { case MessageBusType.Default: break; case MessageBusType.Fake: bus = new FakeScaleoutBus(Resolver, streams: 1); break; case MessageBusType.FakeMultiStream: bus = new FakeScaleoutBus(Resolver, streams: 3); break; default: throw new NotImplementedException(); } if (bus != null) { Resolver.Register(typeof(IMessageBus), () => bus); } }