I'm creating an EventHub client application that sends message to an Event Hub on Azure. Now when I have a message to send (every 5-6 seconds) I create a new instance of the class EventHubClient, then I use it to send data:
public async static void SendListOfMeasurements(string eventHubName, string connectionString, List<Measurement> measurementsList, int maxMessageSize)
{
// Create EventHubClient
EventHubClient client = EventHubClient.CreateFromConnectionString(
connectionString,
eventHubName);
...
Is it a good practice? Or is it better to create it only at startup and then use only the .Send method? What is the best scenario in terms of performance? In the future the ammount of Sends could increase and also the quantity of messages