From c9512c6261a7e8e52632cf7648489dcb4f00d428 Mon Sep 17 00:00:00 2001 From: Scott Fauerbach Date: Mon, 18 Mar 2024 18:20:18 -0400 Subject: [PATCH] Message Info always use last value in the headers. (#1099) --- src/main/java/io/nats/client/api/MessageInfo.java | 8 ++++---- src/main/java/io/nats/client/impl/NatsStreamContext.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/nats/client/api/MessageInfo.java b/src/main/java/io/nats/client/api/MessageInfo.java index 60374beed..206cd8b92 100644 --- a/src/main/java/io/nats/client/api/MessageInfo.java +++ b/src/main/java/io/nats/client/api/MessageInfo.java @@ -67,10 +67,10 @@ public MessageInfo(Message msg, String streamName, boolean direct) { Headers msgHeaders = msg.getHeaders(); this.subject = msgHeaders.getLast(NATS_SUBJECT); this.data = msg.getData(); - seq = Long.parseLong(msgHeaders.getFirst(NATS_SEQUENCE)); - time = DateTimeUtils.parseDateTime(msgHeaders.getFirst(NATS_TIMESTAMP)); - stream = msgHeaders.getFirst(NATS_STREAM); - String temp = msgHeaders.getFirst(NATS_LAST_SEQUENCE); + seq = Long.parseLong(msgHeaders.getLast(NATS_SEQUENCE)); + time = DateTimeUtils.parseDateTime(msgHeaders.getLast(NATS_TIMESTAMP)); + stream = msgHeaders.getLast(NATS_STREAM); + String temp = msgHeaders.getLast(NATS_LAST_SEQUENCE); if (temp == null) { lastSeq = -1; } diff --git a/src/main/java/io/nats/client/impl/NatsStreamContext.java b/src/main/java/io/nats/client/impl/NatsStreamContext.java index a742145af..fce003af7 100644 --- a/src/main/java/io/nats/client/impl/NatsStreamContext.java +++ b/src/main/java/io/nats/client/impl/NatsStreamContext.java @@ -27,7 +27,7 @@ class NatsStreamContext implements StreamContext { final NatsJetStream js; final NatsJetStreamManagement jsm; - // for when this is contructed from the NatsJetStream itself + // for when this is constructed from the NatsJetStream itself NatsStreamContext(String streamName, NatsJetStream js, NatsConnection connection, JetStreamOptions jsOptions) throws IOException, JetStreamApiException { this.streamName = streamName; this.js = js == null ? new NatsJetStream(connection, jsOptions) : js;