Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveMQ production code is incomplete #64

Open
dartartem opened this issue May 21, 2019 · 0 comments
Open

ActiveMQ production code is incomplete #64

dartartem opened this issue May 21, 2019 · 0 comments

Comments

@dartartem
Copy link
Contributor

Message from Chris:

I see this pattern frequently:

public MessageConsumerActiveMQImpl(String url,
Optional user,
Optional password) {
this(url, Collections.emptyMap(), user, password);
}

public MessageConsumerActiveMQImpl(String url,
Map<String, ChannelType> messageModes,
Optional user,
Optional password) {
....
}

A class has two constructors. One is used by tests, the other by production code.

There really should be just one constructor (or to be more precise - constructors needed by production code). Generally, its the most general one, e.g. with the most parameters: in this case its the second constructor. If the tests needs a different constructor then the test code should define a factory method that calls the constructor.

What's weird about this MessageConsumerActiveMQImpl is that the production code uses the simpler constructor: messageModes is always empty. This means one of two things:

MessageConsumerActiveMQImpl implements unused functionality and can be simplified - along with the tests
The production code is incomplete and needs to support the configuration of different ChannelTypes.

I suspect its #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant