lundi 2 novembre 2020

Dependency Inversion with Message Processors

I have an application that performs message processing. I have several different customers and some use Kafka, some RabbitMQ and others ActiveMQ. I want to apply the SOLID principle of Dependency Inversion so that I don't have implementation specific code in my message processor. I don't want my message-processor to care or know about the provider.

I would like to have an Apache Maven multi-module project where I have a module for kafka,RabbitMQ and ActiveMQ. In these modules I only want to receive the message from the message provider and pass that message to my message processor.

I could then have a message-processor maven module that would depend on whichever messaging system my customer used. All my business logic would live in my message-processor module and no message-provider specific code.

So far all I have come up with is to make my message producer modules extend Observable and then, when they receive a message, notify my message processor.

There must be a better way?

Aucun commentaire:

Enregistrer un commentaire