@@ -8,7 +8,7 @@ namespace Socolin.RabbitMQ.Client;
88public enum ChannelType
99{
1010 Publish ,
11- Consumer
11+ Consumer ,
1212}
1313
1414[ PublicAPI ]
@@ -18,14 +18,20 @@ public interface IRabbitMqConnectionManager : IDisposable
1818 void ReleaseChannel ( ChannelType channelType , IChannel channel ) ;
1919}
2020
21- public class RabbitMqConnectionManager ( Uri uri , string connectionName , TimeSpan connectionTimeout , TimeSpan requestedHeart )
21+ public class RabbitMqConnectionManager (
22+ Uri uri ,
23+ string connectionName ,
24+ TimeSpan connectionTimeout ,
25+ TimeSpan requestedHeart ,
26+ ushort maxChannelPerConnection = 90
27+ )
2228 : IRabbitMqConnectionManager
2329{
24- private readonly IRabbitMqChannelManager _publishChannelManager = new RabbitMqChannelManager ( uri , connectionName , connectionTimeout , ChannelType . Publish , requestedHeart ) ;
25- private readonly IRabbitMqChannelManager _consumerChannelManager = new RabbitMqChannelManager ( uri , connectionName , connectionTimeout , ChannelType . Consumer , requestedHeart ) ;
30+ private readonly IRabbitMqChannelManager _publishChannelManager = new RabbitMqChannelManager ( uri , connectionName , connectionTimeout , ChannelType . Publish , requestedHeart , maxChannelPerConnection ) ;
31+ private readonly IRabbitMqChannelManager _consumerChannelManager = new RabbitMqChannelManager ( uri , connectionName , connectionTimeout , ChannelType . Consumer , requestedHeart , maxChannelPerConnection ) ;
2632
2733 public RabbitMqConnectionManager ( Uri uri , string connectionName , TimeSpan connectionTimeout )
28- : this ( uri , connectionName , connectionTimeout , System . Threading . Timeout . InfiniteTimeSpan )
34+ : this ( uri , connectionName , connectionTimeout , System . Threading . Timeout . InfiniteTimeSpan , 90 )
2935 {
3036 }
3137
@@ -62,4 +68,4 @@ public void ReleaseChannel(ChannelType channelType, IChannel channel)
6268 throw new ArgumentOutOfRangeException ( nameof ( channelType ) , channelType , null ) ;
6369 }
6470 }
65- }
71+ }
0 commit comments