<p>The problem: I have a spring boot service running on K8s. Generally API calls can be served by any pod of my service, but for a particular use case we have a requirement to propagate the call to all instances of the service.</p>
<p>A bit of googling led me to <a href="https://discuss.kubernetes.io/t/how-to-broadcast-message-to-all-the-pod/10002" rel="nofollow noreferrer">https://discuss.kubernetes.io/t/how-to-broadcast-message-to-all-the-pod/10002</a> where they suggest using</p>
<p><code>kubectl get endpoints cache -o yaml</code></p>
<p>and proceeding from there. This is fine for a human or a CLI environment, but how do I accomplish the same from within my Java service, aside from executing the above command via <code>Process</code> and parsing the output?</p>
<p>Essentially I want a way to do what the above command is doing but in a more java-friendly way.</p>

<p>Seems like your spring boot service should be listening to a message queue, and when one service receives a specific HTTP request message to the <code>/propagateme</code> endpoint, it sends an event to the topic to all other clients listening to the <code>Propagation topic</code>, when the instances receive a message from the topic they perform the specific action</p>
<p>See JMS <a href="https://spring.io/guides/gs/messaging-jms/" rel="nofollow noreferrer">https://spring.io/guides/gs/messaging-jms/</a></p>
