From the course: Azure Event Hubs for Developers

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Sending messages to an event hub

Sending messages to an event hub - Azure Tutorial

From the course: Azure Event Hubs for Developers

Sending messages to an event hub

- [Instructor] Now, that we have a connection string, and the event hub name, it's time to prepare some events so we can send them. We are going to make it so we can send events continuously. So, let's go ahead and do, while, true. In here, we need to add await task, dot Delay, and, let's say, we want to delay about five seconds. This means that this code is going to be executed every five seconds. Now, let's go ahead and try to send events. In order to send events, first, we need to create a Batch. An event Batch can contain multiple events, that we can send in bulk to our event hub, so we don't make too many requests. Now, that we have the event Batch, we can use our Event Generator Library. Here, our Event Generator Library, let's go ahead and edit as a dependency, and we can use the event generator class. Here, let's say we want to generate 50 events. Let's go ahead and import to library, and we want to get sensor…

Contents