Exemple #1
0
        async Task DataReceivedOnChannel(DataReceivedOnChannelArgs e)
        {
            using (e.Data)
            {
                var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e);

                Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId);

                using (var scope = GatewayTransaction.Scope())
                {
                    switch (callInfo.Type)
                    {
                    case CallType.SingleCallDatabusProperty:
                        await HandleDatabusProperty(callInfo).ConfigureAwait(false);

                        break;

                    case CallType.SingleCallSubmit:
                        await HandleSubmit(callInfo).ConfigureAwait(false);

                        break;

                    default:
                        throw new Exception("Unknown call type: " + callInfo.Type);
                    }
                    scope.Complete();
                }
            }
        }
Exemple #2
0
        void DataReceivedOnChannel(object sender, DataReceivedOnChannelArgs e)
        {
            using (e.Data)
            {
                var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e);

                Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId);

                using (var scope = GatewayTransaction.Scope())
                {
                    switch (callInfo.Type)
                    {
                    case CallType.SingleCallDatabusProperty:
                        HandleDatabusProperty(callInfo);
                        break;

                    case CallType.SingleCallSubmit:
                        HandleSubmit(callInfo);
                        break;

                    default:
                        receiver.DispatchReceivedCallInfo(callInfo);
                        break;
                    }
                    scope.Complete();
                }
            }
        }
        void DataReceivedOnChannel(object sender, DataReceivedOnChannelArgs e)
        {
            using (e.Data)
            {
                var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e);

                Hasher.Verify(callInfo.Data, callInfo.Md5);
                Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId);

                using (var scope = GatewayTransaction.Scope())
                {
                    DispatchReceivedCallInfo(callInfo);
                    scope.Complete();
                }
            }
        }
        async Task DataReceivedOnChannel(DataReceivedOnChannelArgs e, CancellationToken cancellationToken)
        {
            using (e.Data)
            {
                var callInfo = ChannelReceiverHeaderReader.GetCallInfo(e);

                Logger.DebugFormat("Received message of type {0} for client id: {1}", callInfo.Type, callInfo.ClientId);

                if (useTransactionScope)
                {
                    using (var scope = GatewayTransaction.Scope())
                    {
                        await Receive(callInfo).ConfigureAwait(false);

                        scope.Complete();
                    }
                }
                else
                {
                    // create no transaction scope to avoid that only the persistence or the transport enlist with a transaction.
                    // this would cause issues when commiting the transaction fails after the persistence or transport operation has succeeded.
                    await Receive(callInfo).ConfigureAwait(false);
                }
            }

            async Task Receive(CallInfo callInfo)
            {
                switch (callInfo.Type)
                {
                case CallType.SingleCallDatabusProperty:
                    await HandleDatabusProperty(callInfo, cancellationToken).ConfigureAwait(false);

                    break;

                case CallType.SingleCallSubmit:
                    await HandleSubmit(callInfo, cancellationToken).ConfigureAwait(false);

                    break;

                default:
                    throw new Exception("Unknown call type: " + callInfo.Type);
                }
            }
        }