Skip to content

Commit

Permalink
Update README.md (#772)
Browse files Browse the repository at this point in the history
Co-authored-by: ZIO Assistant <zio-assistant[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and calvinlfer committed Jan 9, 2025
1 parent 2f16b34 commit 39a1349
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libraryDependencies += "dev.zio" %% "zio-sqs" % "0.6.5"

## Example

In this example we produce a stream of events to the `MyQueue` and then consume them from that queue:
In this example we produce a stream of events to the `MyQueue` and then consume them from that queue (at-most-once delivery semantics):

```scala
import zio._
Expand All @@ -47,7 +47,10 @@ object ProducerConsumerExample extends ZIOAppDefault {
_ <- ZIO.scoped(producer.flatMap(_.sendStream(stream).runDrain))
_ <- SqsStream(
queueUrl,
SqsStreamSettings(stopWhenQueueEmpty = true, waitTimeSeconds = Some(3))
SqsStreamSettings.default
.withAutoDelete(true)
.withStopWhenQueueEmpty(true)
.withWaitTimeSeconds(3)
).foreach(msg => Console.printLine(msg.body))
} yield ()

Expand All @@ -60,6 +63,8 @@ object ProducerConsumerExample extends ZIOAppDefault {
}
```

Check out the examples folder in `zio-sqs/src/test/scala/examples` for additional examples that cover at-least-once and at-most-once delivery semantics.

## Documentation

Learn more on the [ZIO SQS homepage](https://zio.dev/zio-sqs)!
Expand Down

0 comments on commit 39a1349

Please sign in to comment.