@@ -38,11 +38,10 @@ IAdvancedBus advancedBus
3838 public virtual async Task PublishAsync < T > ( T message , Action < IPublishConfiguration > configure , CancellationToken cancellationToken )
3939 {
4040 using var cts = cancellationToken . WithTimeout ( configuration . Timeout ) ;
41-
42- var publishConfiguration = new PublishConfiguration ( conventions . TopicNamingConvention ( typeof ( T ) ) ) ;
41+ var messageType = typeof ( T ) ;
42+ var publishConfiguration = new PublishConfiguration ( conventions . TopicNamingConvention ( messageType ) ) ;
4343 configure ( publishConfiguration ) ;
4444
45- var messageType = typeof ( T ) ;
4645 var advancedMessageProperties = new MessageProperties
4746 {
4847 Priority = publishConfiguration . Priority ?? 0 ,
@@ -52,7 +51,7 @@ public virtual async Task PublishAsync<T>(T message, Action<IPublishConfiguratio
5251 } ;
5352 var advancedMessage = new Message < T > ( message , advancedMessageProperties ) ;
5453 var exchange = await exchangeDeclareStrategy . DeclareExchangeAsync (
55- messageType , ExchangeType . Topic , cts . Token
54+ messageType , conventions . ExchangeTypeConvention ( messageType ) , cts . Token
5655 ) . ConfigureAwait ( false ) ;
5756 await advancedBus . PublishAsync (
5857 exchange . Name , publishConfiguration . Topic , null , publishConfiguration . PublisherConfirms , advancedMessage , cts . Token
@@ -75,19 +74,19 @@ CancellationToken cancellationToken
7574 )
7675 {
7776 using var cts = cancellationToken . WithTimeout ( configuration . Timeout ) ;
78-
79- var subscriptionConfiguration = new SubscriptionConfiguration ( configuration . PrefetchCount , conventions . QueueTypeConvention ( typeof ( T ) ) ) ;
77+ var messageType = typeof ( T ) ;
78+ var subscriptionConfiguration = new SubscriptionConfiguration ( configuration . PrefetchCount , conventions . QueueTypeConvention ( messageType ) , conventions . ExchangeTypeConvention ( messageType ) ) ;
8079 configure ( subscriptionConfiguration ) ;
8180
8281 var exchange = await advancedBus . ExchangeDeclareAsync (
83- exchange : conventions . ExchangeNamingConvention ( typeof ( T ) ) ,
82+ exchange : conventions . ExchangeNamingConvention ( messageType ) ,
8483 type : subscriptionConfiguration . ExchangeType ,
8584 arguments : subscriptionConfiguration . ExchangeArguments ,
8685 cancellationToken : cts . Token
8786 ) . ConfigureAwait ( false ) ;
8887
8988 var queue = await advancedBus . QueueDeclareAsync (
90- queue : subscriptionConfiguration . QueueName ?? conventions . QueueNamingConvention ( typeof ( T ) , subscriptionId ) ,
89+ queue : subscriptionConfiguration . QueueName ?? conventions . QueueNamingConvention ( messageType , subscriptionId ) ,
9190 durable : subscriptionConfiguration . Durable ,
9291 autoDelete : subscriptionConfiguration . AutoDelete ,
9392 arguments : subscriptionConfiguration . QueueArguments ,
0 commit comments