Пример #1
0
        public void Pub(string subject, string body, string replyTo = null)
        {
            var payload = NatsEncoder.GetBytes(body);

            if (payload.Length > _maxPayload)
            {
                throw NatsException.ExceededMaxPayload(_maxPayload, payload.Length);
            }

            PubCmd.Write(_writer, subject, replyTo, payload);
        }
Пример #2
0
        public Task PubAsync(string subject, string body, string replyTo = null)
        {
            var payload = NatsEncoder.GetBytes(body);

            if (payload.Length > _maxPayload)
            {
                throw NatsException.ExceededMaxPayload(_maxPayload, payload.Length);
            }

            return(PubCmd.WriteAsync(_writer, subject.AsMemory(), replyTo.AsMemory(), payload));
        }