Пример #1
0
        public override async Task <BindingResponse> InvokeBindingAsync(BindingRequest request, CancellationToken cancellationToken = default)
        {
            var bytes    = ByteString.CopyFrom(request.Data.Span);
            var response = await this.MakeInvokeBindingRequestAsync(request.BindingName, request.Operation, bytes, request.Metadata, cancellationToken);

            return(new BindingResponse(request, response.Data.Memory, response.Metadata));
        }
Пример #2
0
        /// <summary>
        /// Initializes a new <see cref="BindingResponse" />.`
        /// </summary>
        /// <param name="request">The <see cref="BindingRequest" /> assocated with this response.</param>
        /// <param name="data">The response payload.</param>
        /// <param name="metadata">The response metadata.</param>
        public BindingResponse(BindingRequest request, ReadOnlyMemory <byte> data, IReadOnlyDictionary <string, string> metadata)
        {
            ArgumentVerifier.ThrowIfNull(request, nameof(request));
            ArgumentVerifier.ThrowIfNull(data, nameof(data));
            ArgumentVerifier.ThrowIfNull(metadata, nameof(metadata));

            this.Request  = request;
            this.Data     = data;
            this.Metadata = metadata;
        }
Пример #3
0
 /// <summary>
 /// Invokes a binding with the provided <paramref name="request" />. This method allows for control of the binding
 /// input and output using raw bytes.
 /// </summary>
 /// <param name="request">The <see cref="BindingRequest" /> to send.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
 /// <returns>A <see cref="Task{T}" /> that will complete when the operation has completed.</returns>
 public abstract Task <BindingResponse> InvokeBindingAsync(
     BindingRequest request,
     CancellationToken cancellationToken = default);