INNER CODE UNIT · C#

DeleteBookEventConsumer

henriquelourente/Domain-Driven-Design-Sample · src/SampleLibrary.Infra.Messaging/DeleteBookEventConsumer.cs:11

    public class DeleteBookEventConsumer : IEventConsumer<DeleteBookEvent, Guid>
    {
        private readonly IBookEventRepository _bookEventRepository;
        private IBus _bus;

        public DeleteBookEventConsumer(IBookEventRepository bookEventRepository)
        {
            _bookEventRepository = bookEventRepository;
        }

        public void Subscribe()
        {
            _bus = RabbitHutch.CreateBus("host=localhost;virtualhost=sample-library;username=guest;password=guest");
            _bus.Subscribe<DeleteBookEvent>(nameof(DeleteBookEvent), HandleMessage);
        }

        public  void Unsubscribe() => _bus.Dispose();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…