locked
How to active the Partitions for an EventHub? RRS feed

  • Question

  • I looking into sth for EventHub follow : http://msdn.microsoft.com/en-us/library/azure/dn789972.aspx

    For instance:

    We have 10 Partitions when create an EventHub, so do we have a way to set which Partitions are active? 

    Sunday, October 26, 2014 5:23 AM

Answers

  • Hi sir,

    Thanks for your posting!

    Events are partitioned based on a system property called PartitionKey, and sent to the Event Hub using an EventhubClient object.

    You could use the Partitions like this :

    Create EventHub : 
     
    var ehd = new EventHubDescription(eventHubName); 
    ehd.PartitionCount = numberOfPartitions; 
    manager.CreateEventHubIfNotExistsAsync(ehd).Wait(); 
     
    Sent Events: 
     
    EventData data = new EventData(bytes) 
    data.PartitionKey = info.DeviceId.ToString(); 
    await client.SendAsync(data); 

    Please refer to this code sample:

    https://code.msdn.microsoft.com/windowsazure/Service-Bus-Event-Hub-286fd097

    Regards,

    Will


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 27, 2014 8:58 AM