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 Life commands to Life Aggregate dispatch( [ PolicyService.Commands.LifePolicy.SubmitPolicyApplication, PolicyService.Commands.LifePolicy.RecordProviderQuote, PolicyService.Commands.LifePolicy.AcceptQuoteAndSolicit, PolicyService.Commands.LifePolicy.RecordPolicyIssued ], to: PolicyService.Aggregates.LifePolicyApplication, identity: :id ) # Route FireStructure commands to FireStructure Aggregate dispatch( [ PolicyService.Commands.FireStructurePolicy.SubmitPolicyApplication, PolicyService.Commands.FireStructurePolicy.RecordProviderQuote, PolicyService.Commands.FireStructurePolicy.AcceptQuoteAndSolicit, PolicyService.Commands.FireStructurePolicy.RecordPolicyIssued ], to: PolicyService.Aggregates.FireStructurePolicyApplication, identity: :id ) # Route FireContents commands to FireContents Aggregate dispatch( [ PolicyService.Commands.FireContentsPolicy.SubmitPolicyApplication, PolicyService.Commands.FireContentsPolicy.RecordProviderQuote, PolicyService.Commands.FireContentsPolicy.AcceptQuoteAndSolicit, PolicyService.Commands.FireContentsPolicy.RecordPolicyIssued ], to: PolicyService.Aggregates.FireContentsPolicyApplication, identity: :id ) end defmodule PolicyService.CommandedApp do use Commanded.Application, otp_app: :policy_service router(PolicyService.Router) end