Esempio n. 1
0
        public async Task ProcessMessageAsync(PcsTopic pcsTopic, string messageJson, CancellationToken cancellationToken)
        {
            _currentUserSetter.SetCurrentUserOid(_ipoApiOid);

            switch (pcsTopic)
            {
            case PcsTopic.Ipo:
                await ProcessIpoEvent(messageJson);

                break;

            case PcsTopic.Project:
                ProcessProjectEvent(messageJson);
                break;

            case PcsTopic.CommPkg:
                ProcessCommPkgEvent(messageJson);
                break;

            case PcsTopic.McPkg:
                ProcessMcPkgEvent(messageJson);
                break;

            case PcsTopic.Library:
                ProcessLibraryEvent(messageJson);
                break;
            }
            await _unitOfWork.SaveChangesAsync(cancellationToken);
        }
        public async Task ProcessMessageAsync(PcsTopic pcsTopic, string messageJson, CancellationToken cancellationToken)
        {
            _currentUserSetter.SetCurrentUserOid(_synchronizationUserOid);

            var currentUser    = _claimsProvider.GetCurrentUser();
            var claimsIdentity = new ClaimsIdentity();

            claimsIdentity.AddClaim(new Claim(ClaimsExtensions.Oid, _synchronizationUserOid.ToString()));
            currentUser.AddIdentity(claimsIdentity);

            switch (pcsTopic)
            {
            case PcsTopic.Project:
                await ProcessProjectEvent(messageJson);

                break;

            case PcsTopic.Responsible:
                await ProcessResponsibleEvent(messageJson);

                break;

            case PcsTopic.TagFunction:
                await ProcessTagFunctionEvent(messageJson);

                break;

            case PcsTopic.CommPkg:
                await ProcessCommPkgEvent(messageJson);

                break;

            case PcsTopic.McPkg:
                await ProcessMcPkgEvent(messageJson);

                break;

            case PcsTopic.Tag:
                await ProcessTagEvent(messageJson);

                break;
            }

            await _unitOfWork.SaveChangesAsync(cancellationToken);
        }
Esempio n. 3
0
 public PcsSubscriptionClient(string connectionString, PcsTopic pcsTopic, string subscriptionName)
     : base(connectionString, pcsTopic.ToString(), subscriptionName, ReceiveMode.PeekLock, RetryPolicy.Default) =>
 public PcsServiceBusConfig WithSubscription(PcsTopic pcsTopic, string subscriptionName)
 {
     Subscriptions.Add(new KeyValuePair <PcsTopic, string>(pcsTopic, subscriptionName));
     return(this);
 }