You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: solutions/message-queue-elasticache/README.md
+41-13Lines changed: 41 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,11 @@ The application provides a single API route (`/api/messages`) with three HTTP me
108
108
109
109
## Testing
110
110
111
-
**Important**: Consumer groups track which messages have been delivered. Once a message is consumed (via GET), it moves to the Pending Entries List (PEL) and won't appear in subsequent GET requests until acknowledged. Always complete the full flow: POST → GET → DELETE.
111
+
**Important Notes:**
112
+
113
+
- Consumer groups track which messages have been delivered. Once a message is consumed (via GET), it moves to the Pending Entries List (PEL) and won't appear in subsequent GET requests until acknowledged.
114
+
- The `streamMessageId` returned by GET is Valkey's unique stream entry ID and **must be used** for the DELETE operation.
115
+
- Always complete the full flow: POST → GET → DELETE.
112
116
113
117
### Complete Message Flow Example
114
118
@@ -117,14 +121,18 @@ The application provides a single API route (`/api/messages`) with three HTTP me
@@ -156,12 +164,14 @@ Response when queue is empty:
156
164
{ "message": null }
157
165
```
158
166
167
+
**Note**: The `claimed` field indicates whether this message was recovered from the Pending Entries List (a previously delivered but unacknowledged message). Messages idle for more than 60 seconds are automatically reclaimed.
168
+
159
169
**3. Acknowledge Message (Mark as Processed)**
160
170
161
-
Use the `streamMessageId` from step 2:
171
+
**Critical**: Use the `streamMessageId` from step 2 for the DELETE operation:
If you GET a message but don't DELETE (acknowledge) it, the message stays in the Pending Entries List. Subsequent GET requests will return `{"message":null}` because the consumer group only delivers new, undelivered messages. To reset for testing:
185
+
**Message Recovery**: If you GET a message but don't DELETE (acknowledge) it, the message stays in the Pending Entries List. After 60 seconds of idle time, subsequent GET requests will **automatically reclaim** that message (indicated by `"claimed": true` in the response). This is a reliability feature that handles consumer failures.
186
+
187
+
**For clean testing**, if you want to reset and start fresh:
176
188
177
189
```bash
178
190
# Access your Valkey instance
179
191
docker exec -it <container_id> valkey-cli
180
192
181
-
# Delete the consumer group to reset
193
+
# Delete the entire stream (removes consumer group too)
0 commit comments