Replies: 1 comment 3 replies
-
Please see the document in https://redis.io/commands/xread/
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
``Hi All,
I have come across an interesting issue where I have two messages being written into the stream at the same millsecond.
Where the XREAD command in the consumer is able to read the first message but not the second one. For example, if two messages are sent at the same millisecond from a certain source, the Redis XADD command in the publishing service attaches:
1st Message: EPOCH Time - 0
2nd Message: EPOCH Time - 1
On the other hand. the XREAD command on the consuming service is currently only able to read the first message (EPOCH Time - 0), while the second message is being ignored and not being retrieved even if I set the max count of messages to be received as 1:
Is there any workaround for this problem and I am really keen to understand the possible reason for this problem.
My Publishing snippet:
await redis.xadd( streamName, "MAXLEN", "~", "1000", "*", "message", JSON.stringify(message) );
My consuming service snippet:
NOTE: I have also tried changing the COUNT from 1 to 2 or many messages at a time.
and, I am using a for of loop to do some business operation with the messages retrieved from stream as such and deleting them:
NOTE: I am using ioredis npm library.
Help would be highly appreciated, thank you!
Beta Was this translation helpful? Give feedback.
All reactions