Пример #1
0
        public EventHubMessageBusIt()
        {
            _loggerFactory = NullLoggerFactory.Instance;
            _logger        = _loggerFactory.CreateLogger <EventHubMessageBusIt>();

            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            Secrets.Load(@"..\..\..\..\..\secrets.txt");

            // connection details to the Azure Event Hub
            var connectionString        = Secrets.Service.PopulateSecrets(configuration["Azure:EventHub"]);
            var storageConnectionString = Secrets.Service.PopulateSecrets(configuration["Azure:Storage"]);
            var storageContainerName    = configuration["Azure:ContainerName"];

            Settings = new EventHubMessageBusSettings(connectionString, storageConnectionString, storageContainerName);

            MessageBusBuilder = MessageBusBuilder.Create()
                                .WithLoggerFacory(_loggerFactory)
                                .WithSerializer(new JsonMessageSerializer())
                                .WithProviderEventHub(Settings);

            MessageBus = new Lazy <EventHubMessageBus>(() => (EventHubMessageBus)MessageBusBuilder.Build());
        }
Пример #2
0
        public EventHubMessageBusIt()
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            // address to the Kafka broker
            var connectionString        = configuration["Azure:EventHub"];
            var storageConnectionString = configuration["Azure:Storage"];
            var storageContainerName    = configuration["Azure:ContainerName"];

            Settings = new EventHubMessageBusSettings(connectionString, storageConnectionString, storageContainerName);

            MessageBusBuilder = new MessageBusBuilder()
                                .WithSerializer(new JsonMessageSerializer())
                                .WithProviderEventHub(Settings);

            MessageBus = new Lazy <EventHubMessageBus>(() => (EventHubMessageBus)MessageBusBuilder.Build());
        }