jmalloc / ax

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

Refactor saga message-to-instance mapping to allow for other strategies. #78

Closed jmalloc closed 6 years ago

jmalloc commented 6 years ago

"Key set" based mapping was previously the only strategy available. But, for aggregates at least, it will be the common case that a message contains the instance ID as one of its fields. In this case we can use a simpler strategy that obtains the instance ID directly from the message.

This PR opens the door to such a strategy by removing the keyset based mapping logic from saga.Handler and moving it into an implementation of saga.Mapper, which has been repurposed from what is now known as keyset.Repository to a more generic interface for any kind of mapping logic.

codecov-io commented 6 years ago

Codecov Report

Merging #78 into master will increase coverage by 0.37%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   33.87%   34.25%   +0.37%     
==========================================
  Files          54       53       -1     
  Lines        1898     1877      -21     
==========================================
  Hits          643      643              
+ Misses       1245     1224      -21     
  Partials       10       10
Impacted Files Coverage Δ
src/axmysql/keyset.go 0% <0%> (ø)
src/ax/saga/behavior.go 0% <0%> (ø) :arrow_up:
src/ax/saga/handler.go 0% <0%> (ø) :arrow_up:

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 214223e...49afe37. Read the comment docs.