Ejemplo n.º 1
0
        void IReqRepImpl.SlaveEndPointWorker(SlaveClientContext ctx)
        {
            var conn = (IConnection)ctx.Connection;
            var sub  = (IPassiveSubscription)ctx.Subscription;

            while (ctx.IsComplete == false)
            {
                MsgOut         m       = sub.NextMessage(CancellationToken.None);
                ISlaveEndPoint ep      = ctx.EndPoints[m.Subject];
                var            segment = ep.GetResponse(m.GetPayloadAsByteArray());
                ctx.AddBytes(m.PayloadLength + segment.Count);
                conn.Publish(
                    new MsgIn(m.ReplyTo).SetPayload(segment),
                    CancellationToken.None
                    );
            }
        }
Ejemplo n.º 2
0
        void IReqRepImpl.SlaveEndPointWorker(SlaveClientContext ctx)
        {
            var conn = (Original.IConnection)ctx.Connection;
            var sub  = (Original.ISyncSubscription)ctx.Subscription;

            while (ctx.IsComplete == false)
            {
                Original.Msg   m       = sub.NextMessage();
                ISlaveEndPoint ep      = ctx.EndPoints[m.Subject];
                var            segment = ep.GetResponse(m.Data);
                ctx.AddBytes(m.Data.Length + segment.Count);

                byte[] ba = new byte[segment.Count];
                Buffer.BlockCopy(segment.Array, segment.Offset, ba, 0, segment.Count);
                conn.Publish(m.Reply, ba);
            }
        }