I have a microservice called reward
. When a customer does a certain activity in a different microservice(spent a specific amount of money), that service publishes an event, lets say SpentRewardingMoney
.
In reward service, my aggregate root is Customer
.
public class Customer: Entity, IAggregateRoot
{
// some properties
public List<CustomerReward> UserRewards { get; private set; } // rewards already given
}
Now in SpentRewardingMoneyConsumer
, I have to give reward to that customer.
Problem is, there is some configuration, for simplification suppose a table RewardRule
(reward amount, is reward active etc) to disburse reward. According to DDD rule, I have to pull everything through aggregate root but this configuration is not part of aggregate root.
How should I pull this table from the database?.