public AzureEventHubService() { ServiceBusConnectionStringBuilder builder = new ServiceBusConnectionStringBuilder(AppConfig.EventHubConnectionString); builder.TransportType = TransportType.Amqp; MessagingFactory factory = MessagingFactory.CreateFromConnectionString(AppConfig.EventHubConnectionString); _client = factory.CreateEventHubClient(AppConfig.EventHubName); }
public async Task InitializeAsync() { var connectionString = _configurationReader["EventHubConnectionString"]; var eventHubPath = _configurationReader["EventHubPath"]; _eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubPath); await Task.FromResult<object>(null); }
/// <summary> /// Constructor /// </summary> /// <param name="deviceName">Device name</param> /// <param name="deviceId">Device ID</param> /// <param name="connectionString">Connection string to Service Bus namespace</param> /// <param name="eventhubentity">Event Hub entity name</param> public IoTClientBase(string deviceName, string deviceId, string connectionString, string eventhubentity) { this.DeviceName = deviceName; this.DeviceId = deviceId; this.queue = new Queue<EventData>(); this.queueEvent = new AutoResetEvent(false); ServiceBusConnectionStringBuilder builder = new ServiceBusConnectionStringBuilder(connectionString); builder.TransportType = TransportType.Amqp; this.factory = MessagingFactory.CreateFromConnectionString(builder.ToString()); this.client = this.factory.CreateEventHubClient(eventhubentity); }