🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
Where are persistent messages being stored if the event broker software is down?
I am a test engineer and currently doing some testing on the Solace PubSub+ event broker software to make sure it fits my company's needs. I am trying to prove that persistent (guaranteed) messages are properly working. The scenario I am testing is either the Solace broker software going down or the message VPNs. If the messages on the client IP (Producer side) are being sent as Persistent, how can I prove on the client side (assuming Solace is down or I don't have access to it) that these undelivered messages are still being stored?
Here is a code excerpt from the SolaceProducerTask.java class that sends messages to the broker IP:
`
while(System.currentTimeMillis() <= elapsedDuration) {
msg = JCSMPFactory.onlyInstance().createMessage(TextMessage.class);
msg.setDeliveryMode(DeliveryMode.PERSISTENT);
msgId++;
try {
String text=null;
// threadId|msgId|publishDateString|publishTimeMillis|PublishTimeNano|guid|AdditonalPayload text = "" + this.scenarioId + "_" + threadId + "|" + msgId + "|" + LocalDateTime.now().toString() + "|" + System.currentTimeMillis() + "|" + System.nanoTime() + "|" + MessageData.getData(payloadSizeKB); msg.setText(text); long sendStartMillis = System.currentTimeMillis(); long sendStartNano = System.nanoTime(); producer.send(msg, destination); long sendEndMillis = System.currentTimeMillis(); long sendEndNano = System.nanoTime(); // threadId|msgId|publishDateString|publishTimeMillis|PublishTimeNano|guid|PublishLatencyMillis|PublishLatencyNano //log.info(text.substring(0, text.indexOf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")) + (sendEndEpoch-sendStartEpoch)); logsQueue.offer(text.substring(0, text.indexOf("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")) + (sendEndMillis-sendStartMillis) + "|" + (sendEndNano - sendStartNano) + "|" + msg.getMessageId()); } catch (JCSMPException e) { String errorString = "" + this.scenarioId + "_" + threadId + "|" + msgId + "|" + LocalDateTime.now().toString() + "|" + System.currentTimeMillis() + "|" + System.nanoTime() + "|" + MessageData.getGUID() + "|0|0|" + e.getMessage() + " - " + e.getCause(); //log.info(errorString); logsQueue.offer(errorString); run = false; if (producer != null) { producer.close(); producer = null; log.info(LocalDateTime.now().toString() + ":[PRODUCER_CLOSED]"); } if (session != null) { session.closeSession(); session = null; log.info(LocalDateTime.now().toString() + ":[SESSION_CLOSED]"); } } try { Thread.sleep(intervalMillis); } catch (InterruptedException e) { log.info(e.getCause() + "\n" + e.getMessage()); } } }
}
`
Best Answer
-
Hi @dleoncarrasco,
From the client perspective since you are using DeliveryMode.Persistent that means the broker has acknowledged receipt of the message and the broker has written the event to disk (when using the software broker).If you're just testing with a standalone broker and want to prove this you probably want to cycle the broker or disable/re-enable the messageVPN and then have a consumer come online and consume the expected messages.
Keep in mind that if you are using a highly available configuration your client should be configured to automatically connect to the backup event broker if the primary goes down. More info here on that config
Hope that helps!
-Marc1
Answers
-
Hi @dleoncarrasco,
From the client perspective since you are using DeliveryMode.Persistent that means the broker has acknowledged receipt of the message and the broker has written the event to disk (when using the software broker).If you're just testing with a standalone broker and want to prove this you probably want to cycle the broker or disable/re-enable the messageVPN and then have a consumer come online and consume the expected messages.
Keep in mind that if you are using a highly available configuration your client should be configured to automatically connect to the backup event broker if the primary goes down. More info here on that config
Hope that helps!
-Marc1