public AzureQueueManager(Func<NamespaceManager> namespaceManager, Func<MessagingFactory> messagingFactory, AutoDeleteOnIdleSetting autoDeleteOnIdle, DefaultMessageTimeToLiveSetting defaultMessageTimeToLive, DefaultTimeoutSetting defaultTimeout, EnableDeadLetteringOnMessageExpirationSetting enableDeadLetteringOnMessageExpiration, GlobalPrefixSetting globalPrefix, MaxDeliveryAttemptSetting maxDeliveryAttempts, IPathFactory pathFactory, IRetry retry, ISqlFilterExpressionGenerator sqlFilterExpressionGenerator, ITypeProvider typeProvider) { _namespaceManager = namespaceManager; _messagingFactory = messagingFactory; _maxDeliveryAttempts = maxDeliveryAttempts; _retry = retry; _typeProvider = typeProvider; _defaultMessageTimeToLive = defaultMessageTimeToLive; _autoDeleteOnIdle = autoDeleteOnIdle; _defaultTimeout = defaultTimeout; _enableDeadLetteringOnMessageExpiration = enableDeadLetteringOnMessageExpiration; _globalPrefix = globalPrefix; _sqlFilterExpressionGenerator = sqlFilterExpressionGenerator; _pathFactory = pathFactory; _knownTopics = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingTopics); _knownSubscriptions = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingSubscriptions); _knownQueues = new ThreadSafeLazy<ConcurrentSet<string>>(FetchExistingQueues); }
public AzureQueueManager(Func <ManagementClient> managementClient, IConnectionManager connectionManager, AutoDeleteOnIdleSetting autoDeleteOnIdle, DefaultMessageTimeToLiveSetting defaultMessageTimeToLive, DefaultTimeoutSetting defaultTimeout, EnableDeadLetteringOnMessageExpirationSetting enableDeadLetteringOnMessageExpiration, GlobalPrefixSetting globalPrefix, MaxDeliveryAttemptSetting maxDeliveryAttempts, ILogger logger, IPathFactory pathFactory, IRetry retry, ISqlFilterExpressionGenerator sqlFilterExpressionGenerator, ITypeProvider typeProvider) { _managementClient = managementClient; _connectionManager = connectionManager; _maxDeliveryAttempts = maxDeliveryAttempts; _logger = logger; _retry = retry; _typeProvider = typeProvider; _defaultMessageTimeToLive = defaultMessageTimeToLive; _autoDeleteOnIdle = autoDeleteOnIdle; _defaultTimeout = defaultTimeout; _enableDeadLetteringOnMessageExpiration = enableDeadLetteringOnMessageExpiration; _globalPrefix = globalPrefix; _sqlFilterExpressionGenerator = sqlFilterExpressionGenerator; _pathFactory = pathFactory; _knownTopics = new ThreadSafeLazy <ConcurrentSet <string> >(FetchExistingTopics); _knownSubscriptions = new ThreadSafeLazy <ConcurrentSet <string> >(FetchExistingSubscriptions); _knownQueues = new ThreadSafeLazy <ConcurrentSet <string> >(FetchExistingQueues); }
private static IPath BuildCornerRailPath(IPathFactory pathFactory) { IPath path = pathFactory.Create(); // Inner float innerRailA = RailingInset; float innerRailB = RailingInset + RailingBaseWidth; path.MoveTo(0, innerRailA); path.LineTo(0, innerRailB); path.ConicTo(innerRailB, innerRailB, innerRailB, 0, 0.75f); path.LineTo(innerRailA, 0); path.ConicTo(innerRailA, innerRailA, 0, innerRailA, 0.75f); // Outer float outerRailA = CanvasSize - RailingInset - RailingBaseWidth; float outerRailB = CanvasSize - RailingInset; path.MoveTo(0, outerRailA); path.LineTo(0, outerRailB); path.ConicTo(outerRailB, outerRailB, outerRailB, 0, 0.75f); path.LineTo(outerRailA, 0); path.ConicTo(outerRailA, outerRailA, 0, outerRailA, 0.75f); return(path); }
public PathRepository(IPathFactory pathFactory, ITreeOfLifeSession session) { _session = session; _paths = new ReadOnlyCollection<Path>(new List<Path> { pathFactory.Create("Paths/1", 11, 1, 1, 2), pathFactory.Create("Paths/2", 12, 2, 1, 3), pathFactory.Create("Paths/3", 13, 3, 1, 6), pathFactory.Create("Paths/4", 14, 4, 2, 3), pathFactory.Create("Paths/5", 15, 5, 2, 6), pathFactory.Create("Paths/6", 16, 6, 2, 4), pathFactory.Create("Paths/7", 17, 7, 3, 6), pathFactory.Create("Paths/8", 18, 8, 3, 5), pathFactory.Create("Paths/9", 19, 9, 4, 5), pathFactory.Create("Paths/10", 20, 10, 4, 6), pathFactory.Create("Paths/11", 21, 11, 4, 7), pathFactory.Create("Paths/12", 22, 12, 5, 6), pathFactory.Create("Paths/13", 23, 13, 5, 8), pathFactory.Create("Paths/14", 24, 14, 6, 7), pathFactory.Create("Paths/15", 25, 15, 6, 9), pathFactory.Create("Paths/16", 26, 16, 6, 8), pathFactory.Create("Paths/17", 27, 17, 7, 8), pathFactory.Create("Paths/18", 28, 18, 7, 9), pathFactory.Create("Paths/19", 29, 19, 7, 10), pathFactory.Create("Paths/20", 30, 20, 8, 9), pathFactory.Create("Paths/21", 31, 21, 8, 10), pathFactory.Create("Paths/22", 32, 22, 9, 10) }); }
public TrackPathBuilder(ITrackParameters trackParameters, IPathFactory pathFactory) { _trackParameters = trackParameters; _pathFactory = pathFactory; _innerTrackOffset = 50.0f - _trackParameters.TrackWidth / 2.0f; _outerTrackOffset = 50.0f + _trackParameters.TrackWidth / 2.0f; _innerPlankOffset = 50.0f - _trackParameters.PlankLength / 2.0f; _outerPlankOffset = 50.0f + _trackParameters.PlankLength / 2.0f; }
public TrackPathBuilder(ITrackParameters parameters, IPathFactory pathFactory) { _parameters = parameters; _pathFactory = pathFactory; _innerTrackOffset = _parameters.CellSize / 2.0f - _parameters.TrackWidth / 2.0f; _outerTrackOffset = _parameters.CellSize / 2.0f + _parameters.TrackWidth / 2.0f; _innerPlankOffset = _parameters.CellSize / 2.0f - _parameters.PlankLength / 2.0f; _outerPlankOffset = _parameters.CellSize / 2.0f + _parameters.PlankLength / 2.0f; }
public TrackPathBuilder(IGameParameters gameParameters, ITrackParameters trackParameters, IPathFactory pathFactory) { _gameParameters = gameParameters; _trackParameters = trackParameters; _pathFactory = pathFactory; _innerTrackOffset = _gameParameters.CellSize / 2.0f - _trackParameters.TrackWidth / 2.0f; _outerTrackOffset = _gameParameters.CellSize / 2.0f + _trackParameters.TrackWidth / 2.0f; _innerPlankOffset = _gameParameters.CellSize / 2.0f - _trackParameters.PlankLength / 2.0f; _outerPlankOffset = _gameParameters.CellSize / 2.0f + _trackParameters.PlankLength / 2.0f; }
static void Main(string[] args) { Console.WriteLine("Boondocks bootstrap starting..."); try { var platformDetector = new PlatformDetector(); IPathFactory pathFactory = platformDetector.CreatePathFactory(); var deviceConfigurationProvider = new DeviceConfigurationProvider(pathFactory); if (deviceConfigurationProvider.Exists()) { //Get the device configuration var deviceConfiguration = deviceConfigurationProvider.GetDeviceConfiguration(); //Create the container using (var container = ContainerFactory.Create(pathFactory, deviceConfiguration, new BootstrapModule())) { //Get the agent host var host = container.Resolve <BootstrapHost>(); var cancellationTokenSource = new CancellationTokenSource(); //We shall cancel on the keypress Console.CancelKeyPress += (sender, eventArgs) => cancellationTokenSource.Cancel(); try { //Run the host host.RunAsync(cancellationTokenSource.Token).GetAwaiter().GetResult(); } catch (TaskCanceledException) { } } } else { //There is no sense is attempting to run without a configuration. SleepForever("Unable to find device configuration."); } } catch (Exception ex) { Console.WriteLine($"An exception occurred: {ex.Message}"); Console.WriteLine(ex.ToString()); } finally { Console.WriteLine("Bootstrap exiting."); } }
private static IPath BuildCornerPlankPath(IPathFactory pathFactory) { IPath path = pathFactory.Create(); path.MoveTo(0, BridgeInset); path.LineTo(0, CanvasSize - BridgeInset); path.ConicTo(CanvasSize - BridgeInset, CanvasSize - BridgeInset, CanvasSize - BridgeInset, 0, 0.75f); path.LineTo(BridgeInset, 0); path.ConicTo(BridgeInset, BridgeInset, 0, BridgeInset, 0.75f); return(path); }
public string Route(Type messageType, QueueOrTopic queueOrTopic, IPathFactory pathFactory) { switch (queueOrTopic) { case QueueOrTopic.Queue: return pathFactory.QueuePathFor(messageType); case QueueOrTopic.Topic: return pathFactory.TopicPathFor(messageType); default: throw new Exception("Cannot build a route for the message type '{0}'.".FormatWith(messageType.FullName)); } }
private static IPath BuildLightPath(IPathFactory pathFactory) { const int halfLightSpread = LightSpread / 2; IPath path = pathFactory.Create(); path.LineTo(-LightLength, -halfLightSpread); path.ConicTo(-LightCurveLength, 0, -LightLength, halfLightSpread, 0.75f); path.LineTo(0, 0); return(path); }
public string Route(Type messageType, QueueOrTopic queueOrTopic, IPathFactory pathFactory) { switch (queueOrTopic) { case QueueOrTopic.Queue: return(pathFactory.QueuePathFor(messageType)); case QueueOrTopic.Topic: return(pathFactory.TopicPathFor(messageType)); default: throw new Exception("Cannot build a route for the message type '{0}'.".FormatWith(messageType.FullName)); } }
public EmbeddedResourceBlogPostLoader(IPathFactory pathFactory, IMarkDownTransformer markDownTransformer, Assembly[] assemblies, RssFeedSettings feedSettings, Func <string, bool> blogPostResourceNameFilter, IEmbeddedResourceImagePathMapper imagePathMapper) { _pathFactory = pathFactory; _markDownTransformer = markDownTransformer; _assemblies = assemblies; _feedSettings = feedSettings; _blogPostResourceNameFilter = blogPostResourceNameFilter; _imagePathMapper = imagePathMapper; }
public BusCommandSender(IDependencyResolver dependencyResolver, IKnownMessageTypeVerifier knownMessageTypeVerifier, ILogger logger, INimbusMessageFactory nimbusMessageFactory, INimbusTransport transport, IOutboundInterceptorFactory outboundInterceptorFactory, IPathFactory pathFactory, IRouter router) { _nimbusMessageFactory = nimbusMessageFactory; _knownMessageTypeVerifier = knownMessageTypeVerifier; _logger = logger; _transport = transport; _router = router; _pathFactory = pathFactory; _dependencyResolver = dependencyResolver; _outboundInterceptorFactory = outboundInterceptorFactory; }
public RequestMessagePumpsFactory(IHandlerMapper handlerMapper, ILogger logger, IMessageDispatcherFactory messageDispatcherFactory, INimbusTransport transport, IPathFactory pathFactory, IRouter router, ITypeProvider typeProvider, PoorMansIoC container) { _logger = logger; _messageDispatcherFactory = messageDispatcherFactory; _handlerMapper = handlerMapper; _typeProvider = typeProvider; _container = container; _pathFactory = pathFactory; _transport = transport; _router = router; }
protected override void Load(ContainerBuilder builder) { //Update services builder.RegisterType <ApplicationUpdateService>().SingleInstance(); builder.RegisterType <AgentUpdateService>().SingleInstance(); //IDockerClient builder.Register(context => { IPathFactory pathFactory = context.Resolve <IPathFactory>(); string endpoint = pathFactory.DockerEndpoint; var dockerClientConfiguration = new DockerClientConfiguration(new Uri(endpoint)); return(dockerClientConfiguration.CreateClient()); }).As <IDockerClient>().SingleInstance(); var sink = new AgentLogSink(BatchSizeLimit, TimeSpan.FromSeconds(BatchPeriodSeconds)); builder.RegisterInstance(sink); Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.Console() .WriteTo.Sink(sink) .CreateLogger(); builder.RegisterInstance(Log.Logger); //Types builder.RegisterType <DeviceStateProvider>().SingleInstance(); builder.RegisterType <UptimeProvider>().As <IUptimeProvider>().SingleInstance(); builder.RegisterType <AgentHost>().As <IAgentHost>().SingleInstance(); builder.RegisterType <ApplicationDockerContainerFactory>().SingleInstance(); builder.RegisterType <AgentDockerContainerFactory>().SingleInstance(); builder.RegisterType <PlatformDetector>().As <IPlatformDetector>().SingleInstance(); builder.RegisterType <ApplicationLogSucker>().SingleInstance(); builder.RegisterType <LogBatchCollector>().SingleInstance(); base.Load(builder); }
public AgentHost( IDeviceConfiguration deviceConfiguration, IUptimeProvider uptimeProvider, DeviceStateProvider deviceStateProvider, IPathFactory pathFactory, DeviceApiClient deviceApiClient, ApplicationUpdateService applicationUpdateService, IRootFileSystemUpdateService rootFileSystemUpdateService, AgentUpdateService agentUpdateService, IDockerClient dockerClient, ApplicationLogSucker applicationLogSucker, ILogger logger) { if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _deviceApiClient = deviceApiClient ?? throw new ArgumentNullException(nameof(deviceApiClient)); _applicationUpdateService = applicationUpdateService ?? throw new ArgumentNullException(nameof(applicationUpdateService)); _rootFileSystemUpdateService = rootFileSystemUpdateService ?? throw new ArgumentNullException(nameof(rootFileSystemUpdateService)); _agentUpdateService = agentUpdateService ?? throw new ArgumentNullException(nameof(agentUpdateService)); _dockerClient = dockerClient ?? throw new ArgumentNullException(nameof(dockerClient)); _applicationLogSucker = applicationLogSucker ?? throw new ArgumentNullException(nameof(applicationLogSucker)); _logger = logger.ForContext(GetType()); _deviceStateProvider = deviceStateProvider ?? throw new ArgumentNullException(nameof(deviceStateProvider)); _uptimeProvider = uptimeProvider ?? throw new ArgumentNullException(nameof(uptimeProvider)); _deviceConfiguration = deviceConfiguration; //Config _logger.Information("Docker Endpoint: {DockerSocket}", pathFactory.DockerEndpoint); _logger.Information("DeviceId: {DeviceId}", deviceConfiguration?.DeviceId); _logger.Information("DeviceApi Url: {DeviceApiUrl}", deviceConfiguration?.DeviceApiUrl); //The agent should be updated before the application _updateServices = new UpdateService[] { _agentUpdateService, _applicationUpdateService }; }
/// <summary> /// /// </summary> /// <param name="pathFactory"></param> /// <param name="deviceConfiguration"></param> /// <param name="customModule">Must provide IRootFileSysteUpdateService.</param> /// <returns></returns> public static IContainer Create(IPathFactory pathFactory, IDeviceConfiguration deviceConfiguration, Module customModule = null) { if (pathFactory == null) { throw new ArgumentNullException(nameof(pathFactory)); } if (deviceConfiguration == null) { throw new ArgumentNullException(nameof(deviceConfiguration)); } var builder = new ContainerBuilder(); //Device api builder.Register(context => new DeviceApiClient( deviceConfiguration.DeviceId, deviceConfiguration.DeviceKey, deviceConfiguration.DeviceApiUrl)).SingleInstance(); builder.RegisterInstance(pathFactory); builder.RegisterInstance(deviceConfiguration); if (customModule != null) { builder.RegisterModule(customModule); } builder.RegisterModule <AgentModule>(); var container = builder.Build(); //TODO: Find less horribly hacky way to do this. var deviceApiClient = container.Resolve <DeviceApiClient>(); var sink = container.Resolve <AgentLogSink>(); sink.DeviceApiClient = deviceApiClient; return(container); }
public string Route(Type messageType, QueueOrTopic queueOrTopic, IPathFactory pathFactory) { switch (queueOrTopic) { case QueueOrTopic.Queue: if (typeof(IBusCommand).IsAssignableFrom(messageType)) { return _singleCommandQueuePath ?? _fallbackRouter.Route(messageType, queueOrTopic, pathFactory); } if (messageType.IsClosedTypeOf(typeof(IBusRequest<,>))) { return _singleRequestQueuePath ?? _fallbackRouter.Route(messageType, queueOrTopic, pathFactory); } break; case QueueOrTopic.Topic: break; } return _fallbackRouter.Route(messageType, queueOrTopic, pathFactory); }
public MulticastRequestMessagePumpsFactory(ApplicationNameSetting applicationName, IFilterConditionProvider filterConditionProvider, IHandlerMapper handlerMapper, ILogger logger, IMessageDispatcherFactory messageDispatcherFactory, INimbusTransport transport, IPathFactory pathFactory, IRouter router, ITypeProvider typeProvider, PoorMansIoC container) { _applicationName = applicationName; _handlerMapper = handlerMapper; _logger = logger; _messageDispatcherFactory = messageDispatcherFactory; _transport = transport; _router = router; _typeProvider = typeProvider; _container = container; _pathFactory = pathFactory; _filterConditionProvider = filterConditionProvider; }
public CompetingEventMessagePumpsFactory(ApplicationNameSetting applicationName, IFilterConditionProvider filterConditionProvider, IHandlerMapper handlerMapper, ILogger logger, IMessageDispatcherFactory messageDispatcherFactory, INimbusTransport transport, IPathFactory pathFactory, IRouter router, ITypeProvider typeProvider, PoorMansIoC container) { _applicationName = applicationName; _handlerMapper = handlerMapper; _logger = logger; _messageDispatcherFactory = messageDispatcherFactory; _transport = transport; _pathFactory = pathFactory; _router = router; _typeProvider = typeProvider; _container = container; _filterConditionProvider = filterConditionProvider; }
public BusMulticastRequestSender(IClock clock, IDependencyResolver dependencyResolver, IKnownMessageTypeVerifier knownMessageTypeVerifier, ILogger logger, INimbusMessageFactory nimbusMessageFactory, INimbusTransport transport, IOutboundInterceptorFactory outboundInterceptorFactory, IPathFactory pathFactory, IRouter router, RequestResponseCorrelator requestResponseCorrelator) { _transport = transport; _router = router; _nimbusMessageFactory = nimbusMessageFactory; _requestResponseCorrelator = requestResponseCorrelator; _pathFactory = pathFactory; _dependencyResolver = dependencyResolver; _outboundInterceptorFactory = outboundInterceptorFactory; _clock = clock; _logger = logger; _knownMessageTypeVerifier = knownMessageTypeVerifier; }
public string Route(Type messageType, QueueOrTopic queueOrTopic, IPathFactory pathFactory) { switch (queueOrTopic) { case QueueOrTopic.Queue: if (typeof(IBusCommand).IsAssignableFrom(messageType)) { return(_singleCommandQueuePath ?? _fallbackRouter.Route(messageType, queueOrTopic, pathFactory)); } if (messageType.IsClosedTypeOf(typeof(IBusRequest <,>))) { return(_singleRequestQueuePath ?? _fallbackRouter.Route(messageType, queueOrTopic, pathFactory)); } break; case QueueOrTopic.Topic: break; } return(_fallbackRouter.Route(messageType, queueOrTopic, pathFactory)); }
public TrackRenderer(ITrackParameters parameters, IPathFactory pathFactory) { _parameters = parameters; _pathFactory = pathFactory; _plankPaint = new PaintBrush { Color = Colors.Black, Style = PaintStyle.Stroke, IsAntialias = true }; _arcTrackClear = new PaintBrush() { Style = PaintStyle.Stroke, Color = Colors.White, IsAntialias = true }; _arcTrackPaint = new PaintBrush() { Style = PaintStyle.Stroke, StrokeWidth = 1, Color = Colors.Black, IsAntialias = true }; _straightTrackPaint = new PaintBrush { Color = Colors.Black, Style = PaintStyle.Stroke, StrokeWidth = 1, IsAntialias = false }; _straightTrackClear = new PaintBrush { Color = Colors.White, Style = PaintStyle.Fill, StrokeWidth = 0 }; }
public EmbeddedResourceImagePathMapper(IPathFactory pathFactory) { _pathFactory = pathFactory; }
public BridgeRenderer(IPathFactory pathFactory, TrackRenderer trackRenderer) { _trackRenderer = trackRenderer; _cornerPlankPath = BuildCornerPlankPath(pathFactory); _cornerRailPath = BuildCornerRailPath(pathFactory); }
public BridgeRenderer(ITerrainMap terrainMap, IPathFactory pathFactory) { _terrainMap = terrainMap; _cornerPlankPath = BuildCornerPlankPath(pathFactory); _cornerRailPath = BuildCornerRailPath(pathFactory); }
public RedisDeadLetterOffice(Func <IDatabase> databaseFunc, IPathFactory pathFactory, ISerializer serializer) { _databaseFunc = databaseFunc; _serializer = serializer; _deadLetterOfficeRedisKey = pathFactory.DeadLetterOfficePath(); }
public DeviceConfigurationProvider(IPathFactory pathFactory) { _pathFactory = pathFactory ?? throw new ArgumentNullException(nameof(pathFactory)); }
public ReplyQueueNameSetting(ApplicationNameSetting applicationName, InstanceNameSetting instanceName, IPathFactory pathFactory) { Value = pathFactory.InputQueuePathFor(applicationName, instanceName); }
public RedisDeadLetterOffice(Func<IDatabase> databaseFunc, IPathFactory pathFactory, ISerializer serializer) { _databaseFunc = databaseFunc; _serializer = serializer; _deadLetterOfficeRedisKey = pathFactory.DeadLetterOfficePath(); }
public SignalRenderer(IPathFactory pathFactory, TrackRenderer trackRenderer) { _lightPath = BuildLightPath(pathFactory); _trackRenderer = trackRenderer; }