Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (26 sloc) 1.12 KB
using System.Threading.Tasks;
using CoreDdd.Domain.Repositories;
using CoreDddShared.Domain;
using CoreDddShared.Domain.Events;
using Rebus.Handlers;
namespace ServiceApp.DomainEventMessageHandlers
{
public class VerifyImoNumberShipCreatedDomainEventMessageHandler : IHandleMessages<ShipCreatedDomainEventMessage>
{
private readonly IRepository<Ship> _shipRepository;
private readonly IInternationalMaritimeOrganizationVerifier _internationalMaritimeOrganizationVerifier;
public VerifyImoNumberShipCreatedDomainEventMessageHandler(
IRepository<Ship> shipRepository,
IInternationalMaritimeOrganizationVerifier internationalMaritimeOrganizationVerifier
)
{
_shipRepository = shipRepository;
_internationalMaritimeOrganizationVerifier = internationalMaritimeOrganizationVerifier;
}
public async Task Handle(ShipCreatedDomainEventMessage message)
{
var ship = await _shipRepository.GetAsync(message.ShipId);
await ship.VerifyImoNumber(_internationalMaritimeOrganizationVerifier);
}
}
}
You can’t perform that action at this time.