initial commit

This commit is contained in:
gwg313 2026-01-15 12:21:18 -05:00
commit 976b4f88cc
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
11 changed files with 249 additions and 0 deletions

View file

@ -0,0 +1,22 @@
import io.nats.client.Connection;
import io.nats.client.Nats;
import java.time.Duration;
public class Publisher {
public static void main(String[] args) throws Exception {
Connection nc = Nats.connect("nats://nats:4222");
int counter = 0;
while (true) {
long sendTime = System.currentTimeMillis();
String msg = counter + "," + sendTime;
nc.publish("demo.subject", msg.getBytes());
nc.flush(Duration.ofSeconds(1));
System.out.println("Sent: " + counter);
counter++;
Thread.sleep(1000);
}
}
}