@@ -28,36 +28,24 @@ protected override RabbitMQTransport CreateTransport(TransportSettings transport
2828 var connectionConfiguration = ConnectionConfiguration . Create ( transportSettings . ConnectionString , string . Empty ) ;
2929 var connectionStringDictionary = ConnectionConfiguration . ParseNServiceBusConnectionString ( transportSettings . ConnectionString , new StringBuilder ( ) ) ;
3030
31- var disableManagementApiString = GetValue ( connectionStringDictionary , "DisableManagementApi " , "false " ) ;
32- if ( ! bool . TryParse ( disableManagementApiString , out var disableManagementApi ) )
31+ var ValidateDeliveryLimitsString = GetValue ( connectionStringDictionary , "ValidateDeliveryLimits " , "true " ) ;
32+ if ( ! bool . TryParse ( ValidateDeliveryLimitsString , out var validateDeliveryLimits ) )
3333 {
34- throw new ArgumentException ( "The value for 'DisableManagementApi ' must be either 'true' or 'false'" ) ;
34+ throw new ArgumentException ( "The value for 'ValidateDeliveryLimit ' must be either 'true' or 'false'" ) ;
3535 }
3636
3737 var transport = new RabbitMQTransport ( RoutingTopology . Direct ( queueType , routingKeyConvention : type => type . FullName . Replace ( "." , "-" ) ) , transportSettings . ConnectionString , enableDelayedDelivery : false ) ;
3838 transport . TransportTransactionMode = transport . GetSupportedTransactionModes ( ) . Contains ( preferredTransactionMode ) ? preferredTransactionMode : TransportTransactionMode . ReceiveOnly ;
39- transport . UseManagementApi = ! disableManagementApi ;
40-
41- if ( ! transport . UseManagementApi )
42- {
43- rabbitMQTransport = transport ;
44- return transport ;
45- }
39+ transport . ValidateDeliveryLimits = validateDeliveryLimits ;
4640
4741 var url = GetValue ( connectionStringDictionary , "ManagementApiUrl" , string . Empty ) ;
48- var username = GetValue ( connectionStringDictionary , "ManagementApiUserName" , connectionConfiguration . UserName ) ;
49- var password = GetValue ( connectionStringDictionary , "ManagementApiPassword" , connectionConfiguration . Password ) ;
5042
5143 if ( ! string . IsNullOrEmpty ( url ) )
5244 {
53- if ( ! string . IsNullOrEmpty ( username ) && ! string . IsNullOrEmpty ( password ) )
54- {
55- transport . ManagementApiConfiguration = new ManagementApiConfiguration ( url , username , password ) ;
56- }
57- else
58- {
59- transport . ManagementApiConfiguration = new ManagementApiConfiguration ( url ) ;
60- }
45+ var username = GetValue ( connectionStringDictionary , "ManagementApiUserName" , connectionConfiguration . UserName ) ;
46+ var password = GetValue ( connectionStringDictionary , "ManagementApiPassword" , connectionConfiguration . Password ) ;
47+ transport . ManagementApiConfiguration = ! string . IsNullOrEmpty ( username ) && ! string . IsNullOrEmpty ( password )
48+ ? new ManagementApiConfiguration ( url , username , password ) : new ManagementApiConfiguration ( url ) ;
6149 }
6250
6351 rabbitMQTransport = transport ;
0 commit comments