in stomp-client/src/main/java/com/aws/sample/amazonmq/StompClient.java [79:97]
private static void sendMessages(StompConnection connection, String type, String destination, String name, int interval, WrapInt count) throws Exception {
while (true) {
count.v++;
connection.begin("tx1");
String message = String.format("[%s://%s] [%s] Message number %s", type, destination, name, count.v);
connection.send(String.format("/%s/%s", type, destination), message, "tx1", null);
connection.commit("tx1");
if (interval > 0) {
System.out.println(String.format("%s - Sender: sent '%s'", df.format(new Date()), message));
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}