Exemplo n.º 1
0
        private void BatchDequeueProc(KeyWrapper <ServerUri, RpcConnection> key, RpcBatchClientTransaction[] txs)
        {
            RpcBatchRequest[] requests = new RpcBatchRequest[txs.Length];

            for (int i = 0; i < txs.Length; i++)
            {
                requests[i] = txs[i].BatchRequest;
            }

            RpcRequest request = new RpcRequest(txs[0].Request.Service, txs[0].Request.Method, null);

            request.BodyBuffer = new RpcBodyBuffer <RpcBatchRequest[]>(requests);

            if (key.Token == null)
            {
                lock (_syncRoot) {
                    key.Token = RpcProxyFactory.GetConnection(key.Key, txs[0].ServiceRole);
                }
            }

            RpcClientTransaction trans = key.Token.CreateTransaction(request);
            RpcClientContext     ctx   = new RpcClientContext(trans);

            ctx.SendRequest(
                delegate(long elapseTicks, RpcClientContext c2, bool successed) {
                try {
                    RpcBatchResponse[] resps = ctx.EndInvoke <RpcBatchResponse[]>();
                    if (resps.Length != txs.Length)
                    {
                        ProcessFailedTxs(txs, RpcErrorCode.InvaildResponseArgs, new Exception("Batch Length NotMatch"));
                    }
                    else
                    {
                        for (int i = 0; i < resps.Length; i++)
                        {
                            txs[i].BatchResponse = resps[i];
                            txs[i].OnTransactionEnd();
                        }
                    }
                } catch (RpcException ex) {
                    ProcessFailedTxs(txs, ex.RpcCode, ex.InnerException);
                } catch (Exception ex) {
                    ProcessFailedTxs(txs, RpcErrorCode.ServerError, ex);
                }
            },
                -1
                );
        }
Exemplo n.º 2
0
 public void EnqueueBatchTransaction(RpcClientContext context)
 {
 }
Exemplo n.º 3
0
 public void EnqueueBatchTransaction(RpcClientContext context)
 {
 }