public void Pub(string subject, ReadOnlyMemory <byte> body, string replyTo = null) { if (body.Length > _maxPayload) { throw NatsException.ExceededMaxPayload(_maxPayload, body.Length); } PubCmd.Write(_writer, subject, replyTo, body); }
public async Task WriteAsync(byte[] data) { if (data.Length > _maxPayloadSize) { throw NatsException.ExceededMaxPayload(_maxPayloadSize, data.Length); } await _stream.WriteAsync(data, 0, data.Length, _cancellationToken).ConfigureAwait(false); }
public void Write(byte[] data) { if (data.Length > _maxPayloadSize) { throw NatsException.ExceededMaxPayload(_maxPayloadSize, data.Length); } _stream.Write(data, 0, data.Length); }
public Task PubAsync(string subject, ReadOnlyMemory <byte> body, string replyTo = null) { if (body.Length > _maxPayload) { throw NatsException.ExceededMaxPayload(_maxPayload, body.Length); } return(PubCmd.WriteAsync(_writer, subject.AsMemory(), replyTo.AsMemory(), body)); }
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); }
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)); }
public async Task WriteAsync(IPayload data) { if (data.Size > _maxPayloadSize) { throw NatsException.ExceededMaxPayload(_maxPayloadSize, data.Size); } for (var i = 0; i < data.BlockCount; i++) { await _stream.WriteAsync(data[i], 0, data[i].Length, _cancellationToken).ConfigureAwait(false); } }
public void Write(IPayload data) { if (data.Size > _maxPayloadSize) { throw NatsException.ExceededMaxPayload(_maxPayloadSize, data.Size); } for (var i = 0; i < data.BlockCount; i++) { _stream.Write(data[i], 0, data[i].Length); } }