We have an azure function node which listens to Eventhub something like below. It seems we have loads of eventHubMessages in production where we are seeing a big lag in time as in we are seeing the logs after 7-8 hours. We are thinking of below options.
->gzip compression on serialized object.
->Have the copy of same node 3-4 times with different function name.
also thinking of below option.
->Is there any maximum limit on string array in below case string[] EventHubMessages
Not sure how much above will be feasible. Any suggestions would be highly appreciated. Thanks in advance.
private static HttpClient httpClient = new HttpClient();
public async static Task Run([EventHubTrigger("EventHubName", Connection = "....", ConsumerGroup = "...")] string[] EventHubMessages, TraceWriter log)
{
using (var request = new HttpRequestMessage(HttpMethod.Post, string.Format($"NewRelicUrl")))
{
var customObjectList = new List<CustomObject>();
converting each message in to some Object from EventHubMessages and adding them to the customObjectList.
var customObjectListJson = JsonConvert.SerializeObject(customObjectList);
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var httpResponse = await httpClient.SendAsync(request);
}
}