Skip to content

Commit

Permalink
Message Info always use last value in the headers. (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottf authored Mar 18, 2024
1 parent 9d5fb0a commit c9512c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/java/io/nats/client/api/MessageInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/nats/client/impl/NatsStreamContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c9512c6

Please sign in to comment.