Ejemplo n.º 1
0
        public async Task Handle(NoeOfferRequest request, IMessageHandlerContext context)
        {
            int    rc;
            String rm = String.Empty;

            try
            {
                NoeDoc doc = await MongoLegacyDriverFactory
                             .GetMongoLegacyDriver()
                             .GetNoeDoc(request.NoeId, request.SagaId.ToString());

                doc.needsoffering = Constants.ZSUS_NOE_TRUE;

                await MongoLegacyDriverFactory.GetMongoLegacyDriver().UpdateNoeDoc(doc);

                EmailNotifcationFactory
                .GetEmailNotifcation()
                .SendNeedsOffering(new EmailParameters(request.NoeId, request.SagaId));

                rc = Constants.ZSUS_NOE_SUCCESS;
                rm = Constants.ZSUS_NOE_SUCCESS_MSG;
                log.InfoFormat(
                    "Needs offering email submitted; sagaid {0}, noeid {1}",
                    request.SagaId, request.NoeId);
            }
            catch (Exception e)
            {
                rc = Constants.ZSUS_NOE_FAIL;
                rm = e.Message;
                log.ErrorFormat(
                    "Offer email not submitted; {0}, {1}, {2}, {3}",
                    request.SagaId, request.NoeId, e.Message, e.StackTrace);
            }

            var response = new NoeOfferRequestComplete(request);

            response.ResponseCode    = rc;
            response.ResponseMessage = rm;
            await context.Reply(response).ConfigureAwait(false);
        }
Ejemplo n.º 2
0
 public async Task Handle(NoeNegotiationResponse message, IMessageHandlerContext context)
 {
     if (message.NoeNegotiated)
     {
         log.InfoFormat("Recieved NoeNegotiationResponse, NoeNegotiated flag TRUE, sending NoeOfferRequest for {0} ({1})",
                        message.NoeId, message.SagaId);
         Data.NoeNegotiated = message.NoeNegotiated;
         var request = new NoeOfferRequest(message);
         var options = new SendOptions();
         options.SetDestination(Constants.ZSUS_NOE_OFFER_REQUEST_ENDPOINT);
         await context.Send(request, options).ConfigureAwait(false);
     }
     else
     {
         log.InfoFormat("Recieved NoeNegotiationResponse, NoeNegotiated flag FALSE for {0} ({1}), sending NoeResponse",
                        message.NoeId, message.SagaId);
         Data.NoeNegotiated = message.NoeNegotiated;
         var request = new NoeResponse(message);
         request.Status = Constants.ZSUS_SAGA_MARKED_COMPLETE;
         var options = new SendOptions();
         options.SetDestination(Constants.ZSUS_NOE_RESPONSE_ENDPOINT);
         await context.Send(request, options).ConfigureAwait(false);
     }
 }