You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the code below, based on the examples in the wiki. It is an Azure Function V3 function, using .NET Core 3.1. I'm running this locally.
Whenever I run this, I notice that I have a lot of open connections, up to a point where I'm running out of connections and the application stalls. The RabbitMQ Management Interface shows all these connections as well, and they all disappear when I kill the application. To my understanding, channels are multiplexed on a single connection, so I would assume a single connection, instead of a connection per function invocation. Therefore, I think this is a bug.
As a 'work-around', I now inject a my own IConnection in my function class, then use using (var channel = connection.CreateModel() { .. } which works as expected. I also notice that it is faster: I was managing 5 msg/sec, now 25 msg/sec.
Code:
[FunctionName("FunctionName")]publicasyncTaskRunAsync([RabbitMQTrigger("QueueName",ConnectionStringSetting="ConnectionString")]BasicDeliverEventArgsmessage,[RabbitMQ(ConnectionStringSetting="ConnectionString")]IModelchannel){// Some processing of the message here.// ...// Publish updates to an exchangevarbatch=channel.CreateBasicPublishBatch();foreach(varupdateinupdates.Values){var(body,properties)=MessagingHelper.ToMessage(update,message);batch.Add(exchange:"ExchangeName",routingKey:"",mandatory:false,properties:properties,body:body);}batch.Publish();// Doesn't help// channel.Close()}
The text was updated successfully, but these errors were encountered:
I'm using the code below, based on the examples in the wiki. It is an Azure Function V3 function, using .NET Core 3.1. I'm running this locally.
Whenever I run this, I notice that I have a lot of open connections, up to a point where I'm running out of connections and the application stalls. The RabbitMQ Management Interface shows all these connections as well, and they all disappear when I kill the application. To my understanding, channels are multiplexed on a single connection, so I would assume a single connection, instead of a connection per function invocation. Therefore, I think this is a bug.
As a 'work-around', I now inject a my own
IConnection
in my function class, then useusing (var channel = connection.CreateModel() { .. }
which works as expected. I also notice that it is faster: I was managing 5 msg/sec, now 25 msg/sec.Code:
The text was updated successfully, but these errors were encountered: