예제 #1
0
        private static void Fill(Span <byte> trg, ReadOnlySpan <char> subscriptionId, ReadOnlySpan <char> maxMessagesString)
        {
            trg[0] = Cmd[0];
            trg[1] = Cmd[1];
            trg[2] = Cmd[2];
            trg[3] = Cmd[3];
            trg[4] = Cmd[4];
            trg[5] = NatsEncoder.SpaceByte;

            var nextSlot = 6;

            nextSlot = NatsEncoder.WriteSingleByteChars(trg, nextSlot, subscriptionId);

            if (!maxMessagesString.IsEmpty)
            {
                trg[nextSlot++] = NatsEncoder.SpaceByte;
                nextSlot        = NatsEncoder.WriteSingleByteChars(trg, nextSlot, maxMessagesString);
            }

            NatsEncoder.WriteCrlf(trg, nextSlot);
        }
예제 #2
0
        private static void Fill(Span <byte> trg, ReadOnlySpan <char> subject, ReadOnlySpan <char> subscriptionId, ReadOnlySpan <char> queueGroup)
        {
            trg[0] = Cmd[0];
            trg[1] = Cmd[1];
            trg[2] = Cmd[2];
            trg[3] = NatsEncoder.SpaceByte;

            var nextSlot = 4;

            nextSlot        = NatsEncoder.WriteSingleByteChars(trg, nextSlot, subject);
            trg[nextSlot++] = NatsEncoder.SpaceByte;

            if (!queueGroup.IsEmpty)
            {
                nextSlot        = NatsEncoder.WriteSingleByteChars(trg, nextSlot, queueGroup);
                trg[nextSlot++] = NatsEncoder.SpaceByte;
            }

            nextSlot = NatsEncoder.WriteSingleByteChars(trg, nextSlot, subscriptionId);
            NatsEncoder.WriteCrlf(trg, nextSlot);
        }
예제 #3
0
        private static void FillPreBody(Span <byte> trg, ReadOnlySpan <char> subject, ReadOnlySpan <char> replyTo, ReadOnlySpan <char> bodySize)
        {
            trg[0] = Cmd[0];
            trg[1] = Cmd[1];
            trg[2] = Cmd[2];
            trg[3] = NatsEncoder.SpaceByte;

            var nextSlot = 4;

            nextSlot        = NatsEncoder.WriteSingleByteChars(trg, nextSlot, subject);
            trg[nextSlot++] = NatsEncoder.SpaceByte;

            if (!replyTo.IsEmpty)
            {
                nextSlot        = NatsEncoder.WriteSingleByteChars(trg, nextSlot, replyTo);
                trg[nextSlot++] = NatsEncoder.SpaceByte;
            }

            nextSlot = NatsEncoder.WriteSingleByteChars(trg, nextSlot, bodySize);

            NatsEncoder.WriteCrlf(trg, nextSlot);
        }