public EventHubsDataPusher(DataPusherConfiguration configuration, IDatasourceRecordSerializer recordSerializer)
        {
            _recordSerializer = recordSerializer;

            _processorCount  = Environment.ProcessorCount;
            _eventHubClients = new List <EventHubClient>(_processorCount);

            var factory = MessagingFactory.Create(
                "sb://" + configuration.EventHubNamespace + ".servicebus.windows.net/",
                new MessagingFactorySettings
            {
                TokenProvider =
                    TokenProvider.CreateSharedAccessSignatureTokenProvider(configuration.EventHubSharedAccessKeyName,
                                                                           configuration.EventHubSharedAccessKey),
                TransportType         = TransportType.Amqp,
                AmqpTransportSettings = new AmqpTransportSettings()
            });

            for (var i = 0; i < _processorCount; i++)
            {
                var newConnnection = factory.CreateEventHubClient(configuration.EventHubPath);

                _eventHubClients.Add(newConnnection);
            }

            Log.DebugFormat("Initialized {0} Event Hub clients", _processorCount);
        }
Exemplo n.º 2
0
        public Pusher(ITimer timer, IDateTime dateTime, DataPusherConfiguration configuration, ILocalRecordRepository repository, IDataPusher remotePusher)
        {
            _timer        = timer;
            _dateTime     = dateTime;
            _config       = configuration;
            _repo         = repository;
            _remotePusher = remotePusher;

            _timer.Tick += TimerOnTick;
        }
Exemplo n.º 3
0
 public ServiceBusQueueDataPusher(DataPusherConfiguration configuration, IDatasourceRecordSerializer recordSerializer)
 {
     _config           = configuration;
     _recordSerializer = recordSerializer;
     _factory          = MessagingFactory.CreateFromConnectionString(_config.ReceiverQueue.GetConnectionString());
 }