コード例 #1
0
ファイル: DaprClientGrpc.cs プロジェクト: sol-lee/dotnet-sdk
        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
ファイル: BindingResponse.cs プロジェクト: dapr/dotnet-sdk
        /// <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);