コード例 #1
0
        public static async Task HeartbeatProcessor(TextWriter log, ILogger logger)
        {
            _processor = new HeartbeatProcessor(new AzureTableStorageHeartbeatRepository(logger), new ConsoleNotificationAccess(logger));

            var token = new CancellationToken();

            var bus = Bus.Factory.CreateUsingAzureServiceBus(cfg =>
            {
                var connectionString = ConfigurationManager.ConnectionStrings["ServiceBusConnectionString"]
                                       .ConnectionString;

                cfg.Host(connectionString, configurator => { });
                cfg.ReceiveEndpoint("HeartbeatProcessor", e => { e.Consumer(typeof(StatusUpdateConsumer), type => new StatusUpdateConsumer(_processor, logger)); });
            });

            await bus.StartAsync(token);

            await _processor.Run(token);
        }
コード例 #2
0
 internal StatusUpdateConsumer(HeartbeatProcessor processor, ILogger logger)
 {
     _processor = processor;
     _logger    = logger;
 }