jmalloc / ax

A message-driven application toolkit for Go. [EXPERIMENTAL]
MIT License
9 stars 3 forks source link

Implement delayed message sending. #123

Closed jmalloc closed 6 years ago

jmalloc commented 6 years ago

By specifying the ax.Delay() or DelayUntil() option when calling Sender.ExecuteCommand(), the user can now delaying the sending of a command. This is used to implement time-based logic within the application domain.

The delay system supports delayed events, but the public API does not currently allow it as I don't think it makes much sense.

To be used in production we will need some kind of locking to prevent multiple endpoint instances from sending the same delayed messages. This is not strictly part of the delayed messaging feature so I'll do it as a separate PR.

jmalloc commented 6 years ago

I probably should come up a way to work this into the banking example.

codecov-io commented 6 years ago

Codecov Report

Merging #123 into master will decrease coverage by 0.52%. The diff coverage is 57.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
- Coverage   30.05%   29.53%   -0.53%     
==========================================
  Files          67       70       +3     
  Lines        2352     2377      +25     
==========================================
- Hits          707      702       -5     
- Misses       1634     1664      +30     
  Partials       11       11
Impacted Files Coverage Δ
src/axmysql/messagestore/fetcher.go 0% <ø> (ø) :arrow_up:
src/ax/saga/persistence/eventsourcing/recorder.go 0% <0%> (ø) :arrow_up:
src/ax/saga/applier.go 0% <0%> (ø) :arrow_up:
src/axmysql/messagestore/stream.go 0% <0%> (ø) :arrow_up:
src/axrmq/marshaling.go 0% <0%> (ø) :arrow_up:
src/axmysql/messagestore/append.go 0% <0%> (ø) :arrow_up:
src/ax/envelope.go 100% <100%> (ø) :arrow_up:
src/ax/marshaling/time.go 100% <100%> (ø)
src/ax/delay.go 100% <100%> (ø)
src/axmysql/outbox/repository.go 82.6% <80%> (-4.55%) :arrow_down:
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7b2fc7f...ce0d488. Read the comment docs.