-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I'm using two ZIO scope blocks in my codebase one of them is for creating commands and the other for listening if an event published. When the command and the listener are in the same code block and run sequentially, there is no problem, but when they are run in different time intervals, the listening side does not receive information. How can I solve this?
There is a pub/sub mechanism or it's reading from the database?
Command code block like this example; https://github.com/hnaderi/edomata-example/blob/05609b7f54388dae89b9a925eea21b794db9fd39/core/src/main/scala/dev/hnaderi/example/Main.scala#L47
Listening code block
def mySink(app: Application[Task]) = ZSink.foreach((item: OutboxItem[Notification]) =>
for {
_ <- printLine("mySink: " + item)
_ <- app.accounts.storage.outbox.markAsSent(item)
} yield ()
)
def printOutbox(app: Application[Task]) = app.accounts.storage.outbox.read.toZStream().run(mySink(app))
ZIO.scoped {
for {
app <- Application[Task]().toScopedZIO
_ <- printOutbox(app)
} yield ()
}..forkReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels