Example #1
0
        public async Task <ActionResult> CreatePersonReportsByLocation(CreatePersonReportsByLocationCommand command)
        {
            var context = CorrelationContext.Create(Guid.NewGuid(), command.PersonId);

            await BusPublisher.SendAsync(command, context);

            return(Accepted(context));
        }
Example #2
0
        public async Task HandleAsync(SynchronizationAcceptedEvent @event, ISagaContext sagaContext)
        {
            logger.LogInformation($"{nameof(@event)} ({sagaContext.CorrelationId}) {this.GetType()}");

            await busPublisher.SendAsync(
                new MergeSynchronizationDataCommand(),
                CorrelationContext.Create(sagaContext.CorrelationId));
        }
Example #3
0
        protected CorrelationContext GetContext <T>(Guid?resourceId = null, string resource = "") where T : ICommand
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(CorrelationContext.Create <T>(Guid.NewGuid(), Guid.NewGuid(), resourceId ?? Guid.Empty, Request.Path.ToString(), Culture, resource));
        }
        protected ICorrelationContext GetContext <T>(Guid?resourceId = null, string resource = "") where T : ICommand
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(CorrelationContext.Create <T>(Guid.NewGuid(), UserId, resourceId ?? Guid.Empty));
        }
        protected ICorrelationContext GetContext(Guid?resourceId = null, string resource = "")
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(CorrelationContext.Create <int>(Guid.NewGuid(), Guid.Empty, resourceId ?? Guid.Empty,
                                                   "origin", "traceId", "context", "connectionId", "culture", resource));
        }
        protected ICorrelationContext GetContext <T>(Guid?resourceId = null, string resource = "") where T : IRequest
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(CorrelationContext.Create <T>(Guid.NewGuid(), UserId, resourceId ?? Guid.Empty,
                                                 HttpContext.TraceIdentifier,
                                                 Request.Path.ToString(), Culture, resource));
        }
 protected ICorrelationContext GetContext <T>(Guid?resourceId = null, string resource = "") where T : ICommand
 {
     if (!string.IsNullOrWhiteSpace(resource))
     {
         resource = $"{resource}/{resourceId}";
     }
     //send SpanTracerContext of our tracer with request
     return(CorrelationContext.Create <T>(Guid.NewGuid(), UserId, resourceId ?? Guid.Empty,
                                          HttpContext.TraceIdentifier, HttpContext.Connection.Id, _tracer.ActiveSpan.Context.ToString(),
                                          Request.Path.ToString(), Culture, resource));
 }
Example #8
0
        protected ICorrelationContext GetContext <T>(string resourceId = "", string resource = "") where T : ICommand
        {
            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(CorrelationContext.Create <T>(SagaId.NewSagaId(), UserId, resourceId,
                                                 HttpContext.TraceIdentifier, HttpContext.Connection.Id, Tracer?.ActiveSpan?.Context?.ToString() ?? "",
                                                 Request.Path.ToString(), Culture, resource));
        }
Example #9
0
 private ICorrelationContext GetContext()
 => CorrelationContext.Create <GreetUser>(
     id: Guid.NewGuid(),
     userId: Guid.NewGuid(),
     resourceId: Guid.NewGuid(),
     origin: "api/values",
     traceId: _tracer.ActiveSpan.Context.TraceId.ToString(),
     spanContext: _tracer.ActiveSpan.Context.ToString(),
     connectionId: "",
     culture: "",
     resource: "");
Example #10
0
        protected Task <ICorrelationContext> GetContextAsync <T>(Guid?resourceId = null, string resource = "") where T : IMessage
        {
            var(identityClaim, issuerClaim) = GetIdentityClaims();

            if (!string.IsNullOrWhiteSpace(resource))
            {
                resource = $"{resource}/{resourceId}";
            }

            return(Task.FromResult(CorrelationContext.Create <T>(Guid.NewGuid(), UserId, resourceId ?? Guid.Empty,
                                                                 HttpContext.TraceIdentifier, HttpContext.Connection.Id,
                                                                 Request.Path.ToString(), Culture, resource)));
        }
Example #11
0
 //This method is only for AllowAnonymus CustomerController
 protected ICorrelationContext GetContext(Guid customerId)
 {
     return(CorrelationContext.Create(Guid.NewGuid(), customerId));
 }
Example #12
0
 public Task HandleAsync(SynchronizationScheduledEvent @event)
 => HandleAsync(@event, CorrelationContext.Create());
Example #13
0
 public Task HandleAsync(AcceptSynchronizationCommand command)
 => HandleAsync(command, CorrelationContext.Create());
Example #14
0
 public Task HandleAsync(MergeSynchronizationDataCommand command)
 => HandleAsync(command, CorrelationContext.Create());
Example #15
0
        public async Task <IActionResult> AcceptSynchronization(AcceptSynchronizationCommand command)
        {
            await busPublisher.SendAsync(command, CorrelationContext.Create());

            return(Accepted());
        }
Example #16
0
 public Task HandleAsync(TEvent @event)
 => HandleAsync(@event, CorrelationContext.Create());