defmodule PolicyService.Router do use Commanded.Commands.Router # Route Car commands to Car Aggregate dispatch( [ PolicyService.Commands.CarPolicy.SubmitPolicyApplication, PolicyService.Commands.CarPolicy.RecordProviderQuote, PolicyService.Commands.CarPolicy.AcceptQuoteAndSolicit, PolicyService.Commands.CarPolicy.RecordPolicyIssued ], to: PolicyService.Aggregates.CarPolicyApplication, identity: :id ) # Route Fire commands to Fire Aggregate dispatch( [ PolicyService.Commands.FirePolicy.SubmitPolicyApplication, PolicyService.Commands.FirePolicy.RecordProviderQuote, PolicyService.Commands.FirePolicy.AcceptQuoteAndSolicit, PolicyService.Commands.FirePolicy.RecordPolicyIssued ], to: PolicyService.Aggregates.FirePolicyApplication, identity: :id ) end defmodule PolicyService.CommandedApp do use Commanded.Application, otp_app: :policy_service router(PolicyService.Router) end