Exemplo n.º 1
0
 public void Handle()
 {
     _serviceBusSubscriber.To("CustomerServiceRequest", async(messageType, payload, messageId) =>
     {
         if (messageType.ToLowerInvariant() == nameof(ReserveCreditCommand).ToLowerInvariant())
         {
             await _serviceBusPublisher.Publish("CustomerServiceReply", new CustomerCreditExceededEvent("Exceeded customer credit limit"));
         }
     });
 }
Exemplo n.º 2
0
 public override void OnSubscribe()
 {
     _serviceBusSubscriber.To(_queue, (messageType, payload, messageId) =>
     {
         if (messageType.ToLowerInvariant() == nameof(CustomerCreditReservedEvent).ToLowerInvariant())
         {
             CustomerCreditReservedEvent customerCreditReservedEvent = JsonConvert.DeserializeObject <CustomerCreditReservedEvent>(payload);
             Success(customerCreditReservedEvent);
         }
         else if (messageType.ToLowerInvariant() == nameof(CustomerCreditExceededEvent).ToLowerInvariant())
         {
             CustomerCreditExceededEvent customerCreditReservedEvent = JsonConvert.DeserializeObject <CustomerCreditExceededEvent>(payload);
             Failure(customerCreditReservedEvent);
         }
     });
 }