Learning/AWS SQS/29 — Hands-on Labs/Lab 09 — Build a Java consumer
Intermediate outline
This chapter is an outline. The curriculum, learning objectives and structure are settled; the prose, diagrams and code are still being written. What is below is the plan for the chapter, not the chapter.

Lab 09 — Build a Java consumer

Goal

A correct SDK v2 poll loop: long polling, batching, error isolation, batched deletes.

Setup

To be written — CLI commands and an IaC equivalent for every resource, all prefixed sqs-course-.

Steps

  1. Build an SqsClient with the default credential provider
  2. Write the poll loop: long poll 10 messages
  3. Process each with per-message exception isolation
  4. Accumulate successful receipt handles and batch-delete
  5. Handle the Failed list from the delete
  6. Add ApproximateReceiveCount to every log line
  7. Run it against a queue with a deliberately failing message

What you should observe

  • The failing message retries while the others complete
  • A consumer that isolates per-message errors does not lose a batch to one bad item
  • Receive count in the logs tells you which messages are struggling

Why it happened

To be written — ties each observation back to the mechanism in 04 — Sending and Receiving Messages.

Experiments to try

To be written — deliberate variations that change the outcome.

Teardown

To be written — every resource created above, in dependency order.


Back to: 29 — Hands-on Labs