Skip to content

Commit

Permalink
Fix doc examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mladens committed Sep 26, 2024
1 parent 757537c commit e5f3aa0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/getting-started/subscribing.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ Batching method exposes `MessageBatch` giving user control over entire batch as
Chunked messages can be accessed via `messages`.

```scala mdoc:compile-only
import cats.effect.Outcome

subscriber
.messageBatches(batchSize = 10, waitingTime = 20.seconds)
.evalMap { batch =>
Expand All @@ -147,7 +149,7 @@ subscriber
IO.println(s"Received $payload")
}
}.guaranteeCase {
case Outcome.Succeeded(_) => batch.ackAll()
case Outcome.Succeeded(_) => batch.ackAll
case _ => batch.nackAll
}
}
Expand Down Expand Up @@ -240,6 +242,8 @@ subscriber.puller.use { queuePuller =>
To pull batches that can be acknowledged in batches, use `pullMessageBatch()`

```scala mdoc:compile-only
import cats.effect.Outcome

subscriber.puller.use { queuePuller =>

queuePuller
Expand All @@ -249,8 +253,8 @@ subscriber.puller.use { queuePuller =>
message.payload.flatMap { payload =>
IO.println(s"Received $payload")
}.guaranteeCase {
case Outcome.Succeeded(_) => batch.ackAll()
case _ => batch.nackAll()
case Outcome.Succeeded(_) => batch.ackAll
case _ => batch.nackAll
}
}
}
Expand Down

0 comments on commit e5f3aa0

Please sign in to comment.