I have written a Monix Consumer that wraps a Kafka Producer and am at a loss about what to name the result. KafkaConsumer is already a class, which has essentially the opposite meaning which the developers in this code base are much more familiar with. The opposite names are because Kafka names accordingly to consuming from the wire, whereas Monix names accordingly to consuming from producers within the code.

What name most clearly communicates that this Consumer is expected to be used where a KafkaProducer was previously used, and not where a KafkaConsumer was previously used, without causing additional confusion for people looking at it from the Monix point of view? Why is your suggested name better?


As you are connecting two technologies that use the terms producer and consumer differently, I would stay away from those terms.

I would probably call the component something like MonixKafkaConnector

  • 1
    The only thing I would add is that MonixKafkaConnector doesn't tell you the direction of the flow of data. How about MonixToKafkaConnector ? – MetaFight Dec 29 '17 at 10:52
  • @metafight, for a unidirectional data flow that would indeed be better. I don't know the technologies to know if they are uni- or bidirectional. – Bart van Ingen Schenau Dec 29 '17 at 12:51

Naming is hard, Martin Fowler and Uncle Bob (Robert C. Martin) acknowledge that. But it is only hard, because we are really not good at that. Me neither.

Still, let me try to give you an advise.

In general, I try to avoid names ending with -er, or -or, because they usually point to re-use of names of action or method names such as Connector has a connect method. So, don't name your classes and objects after actions. As always, there are some exceptions such as User, Adapter, etc.

Also, one good advise comes from Uncle Bob. Names relate to your system architecture and you should not name your classes after the underlying technology, but after the role in your system. If you look on a blue print of a library, you can see what parts are the book shelves that what part is the seating and desks for the readers, etc. the blue print would not state the materials used, such as wood, concrete, nails, etc. So, name your classes after the purpose they serve instead of the technology you used.

In your case, let me try this ... You try to transfer messages from one queue to the other, so my first guess would be MessageGateway. Sounds silly? Maybe. But you might want to give it a deeper meaning, by telling what kind of messages are transferred. If you think it is not distinct, because you push all kind of messages over that Gateway, then maybe you have violated Single Responsibility Principle and you want to split it up? ... enough guessing.

Try it, it is hard, but it will pay off because it will become easier the more names you found and the more practice you have.

As I said ... naming is hard, but keep on trying!

Further reading:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.