You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DB-Interface just makes all the calls to the database and fetches message events and then bundles them up to the appropriate object for consumption called Payload then publishes it to the kafka topic 'message-queue'.
Then the Message-Interface sends out the message and then publishes back the response signifing either the message was delivered or not to a topic called 'status-queue'.
Now status-queue is being consumed by the Query-interface to then update the records in the DB.
My Issue is; I have configured or at least tried to configure my producer so that it maintains idempodence to avoid sending duplicates but I still seem to be missing something.
This is how I consume it at in message-interface and return the response on the other topic.
@Incoming("message-in")
@Outgoing("update-status")
public Uni<MessageStatus> sink(Message message) {
LOGGER.info(message);
String[] array = {"P", "N", "Y"};
Random random = new Random();
int r = random.nextInt(3) ;
return Uni.createFrom().item(new MessageStatus(message.messageId(), array[r]));
}
Could someone please help me with the idempodence because I can still send duplicate messages to the message-queue even though I am using a 'key' which will always be unique. Any help will be much appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have two microservices
The DB-Interface just makes all the calls to the database and fetches message events and then bundles them up to the appropriate object for consumption called Payload then publishes it to the kafka topic 'message-queue'.
Then the Message-Interface sends out the message and then publishes back the response signifing either the message was delivered or not to a topic called 'status-queue'.
Now status-queue is being consumed by the Query-interface to then update the records in the DB.
My Issue is; I have configured or at least tried to configure my producer so that it maintains idempodence to avoid sending duplicates but I still seem to be missing something.
These are my configurations so far.
DB-Interface
Message-Interface
Then this is my implementation of publishing the message to the message-queue
This is how I consume it at in message-interface and return the response on the other topic.
Could someone please help me with the idempodence because I can still send duplicate messages to the message-queue even though I am using a 'key' which will always be unique. Any help will be much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions