Reputation: 2730
NSB 8 uses namespace:class when creating exchanges in RabbitMQ. like this:
PMSRecalc.MessageHandling:CompetitorDataIsReady
This gives problem when sending messages from quarkus using camels rabbitmq plug-in.
How can I override the default naming conventions with something like namespace-classname
PMSRecalc.MessageHandling-CompetitorDataIsReady
Currently in quarkus, I am using this hack
#Using exchange with colon ":" in name is tricky as the component thinks we use old server:port syntax
#Forcing old syntax by using three slashes does the trick - text after the third slash can only be interpreted as exchange name
outnsb: rabbitmq:///TradingService.Messages:NetAssetValueMessageList?exchangeType=fanout&routingKey=nav&skipQueueDeclare=true&autoDelete=false
I have heard that in the new spring version camel's RabbitMQ component will remove this hack. Haven't tried it, but I would like to be ready. Would also like to get rid of this warning
The old syntax rabbitmq://hostname:port/exchangeName is deprecated ..
Upvotes: 0
Views: 59
Reputation: 1
This is a valid feature request. Could you raise a GitHub issue here? This way you can track progress on this being incorporated into our product.
Upvotes: 0
Reputation: 2730
After some hours reading through the NSB documentation I found this paragraph
var transport = endpointConfiguration.UseTransport<RabbitMQTransport>();
transport.UseCustomRoutingTopology(
topologyFactory: createDurableExchangesAndQueues =>
{
return new MyRoutingTopology(createDurableExchangesAndQueues);
});
I decompiled the ConventionalRoutingTopology class and made a small modification to the constructor
public CustomConventionalRoutingTopology(bool durable, QueueType queueType)
{
_durable = durable;
_queueType = queueType;
_exchangeNameConvention = type => type.Namespace + "_" + type.Name;
}
And using my new custom class like this:
var transport = epc.UseTransport<RabbitMQTransport>()
.ConnectionString(config.ConnectionString)
.UseCustomRoutingTopology(topologyFactory:
createDurableExchangesAndQueues =>
new
CustomConventionalRoutingTopology(createDurableExchangesAndQueues,
QueueType.Classic));
I am still very interested in a solution that don't require custom code.
Upvotes: 0