예제 #1
0
        static async Task Main(string[] args)
        {
            var eventHubConnectionString = $"Endpoint=sb://event-hub-examples.servicebus.windows.net/;SharedAccessKeyName={SHARED_ACCESS_KEY_NAME};SharedAccessKey={SHARED_ACCESS_KEY};EntityPath={EVENT_HUB_NAME}";

            _client = EventHubClient.CreateFromConnectionString(eventHubConnectionString);
            var runtimeInformation = await _client.GetRuntimeInformationAsync();

            var partitionInformation = runtimeInformation.PartitionIds;

            var partitionSender = _client.CreatePartitionSender(partitionInformation[0]);

            var newEventData = new SimpleDataModel()
            {
                Age       = 35,
                FirstName = "User",
                LastName  = "Named"
            };

            await partitionSender.SendAsync(newEventData.ToEventData());

            var newEventData2 = new
            {
                Age       = 15,
                FirstName = "Pracka",
                LastName  = "Meen"
            };

            await _client.SendAsync(EventDataMapper.MapToEventData(newEventData2));
        }
예제 #2
0
 public EventData ToEventData()
 {
     return(EventDataMapper.MapToEventData(this));
 }