rabbitmq-mock icon indicating copy to clipboard operation
rabbitmq-mock copied to clipboard

MockFanoutExchange constructor accessibility

Open vstoyanov opened this issue 4 years ago • 1 comments

Hello everyone,

First of all thank you to the maintainers for your amazing piece of software - it has saved us tons of time and seems to be quite nicely extensible.

Is there a reason why com.github.fridujo.rabbitmq.mock.exchange.MockFanoutExchange.MockFanoutExchange() is protected?

I only want to implement a delegating "x-delayed-message" mock where the underlying exchange type is defined by "x-delayed-type" AmqArgument.

Best regards, Vasil Stoyanov

vstoyanov avatar Jan 15 '21 11:01 vstoyanov

Hello :wave:

Thanks for your compliments, it is a pleasure !

I guess the initial motivation for keeping the constructor of MockFanoutExchange protected is to encourage creating a subclass of BindableMockExchange or one of its existing subclasses when in need of a new exchange type.

You can find an implementation of a delaying exchange in tests (cf https://github.com/fridujo/rabbitmq-mock/blob/master/src/test/java/com/github/fridujo/rabbitmq/mock/exchange/FixDelayExchange.java).

You can use this implementation and change its super class to MockFanoutExchange if that is you need.

For the dynamic part of the delegate exchange, why not simply chain two exchanges ? (or more if you need specific routing strategies depending on a message property)

ledoyen avatar Jan 15 '21 20:01 ledoyen