Open burakakca opened 1 year ago
Basically storage methods are all providing data from database itself, there are also notifications for updates (both in journal and outbox), so you can listen to them and read when necessary.
outbox.read
reads all of the available outboxed messages.
You can also use edomata.backend.OutboxConsumer
which handles all of these, so you don't need to do it by hand, as most of the storage methods are low-level.
You can see how OutboxConsumer
works in the following code:
https://github.com/hnaderi/edomata/blob/ea3a7549b961a107c0aaadda2a8308cc34d6794e/modules/backend/src/main/scala/OutboxConsumer.scala#L47-L56
but when they are run in different time intervals, the listening side does not receive information
What do you mean by different time intervals? Are they running in parallel? Can you provide an example and its results?
What do you mean by different time intervals? Are they running in parallel?
Yes, running on different zio fibers.
Is your problem solved?
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