Class CompressorPipelineExtensions
- Namespace
- IceRpc
- Assembly
- IceRpc.Compressor.dll
Provides an extension method for Pipeline to add the compressor interceptor.
public static class CompressorPipelineExtensions
- Inheritance
-
CompressorPipelineExtensions
- Inherited Members
Methods
UseCompressor(Pipeline, CompressionFormat, CompressionLevel)
Adds a CompressorInterceptor to this pipeline.
public static Pipeline UseCompressor(this Pipeline pipeline, CompressionFormat compressionFormat, CompressionLevel compressionLevel = CompressionLevel.Fastest)
Parameters
pipelinePipelineThe pipeline being configured.
compressionFormatCompressionFormatThe compression format for the compress operation.
compressionLevelCompressionLevelThe compression level for the compress operation.
Returns
- Pipeline
The pipeline being configured.
Examples
The following code adds the compressor interceptor to the invocation pipeline.
// The server uses a test certificate, so we trust its root CA. CreateClientAuthenticationOptions
// is a helper from examples/common/Program.Authentication.cs in the icerpc-csharp repo.
using var rootCA = X509CertificateLoader.LoadCertificateFromFile("certs/cacert.der");
await using var connection = new ClientConnection(
new Uri("icerpc://localhost"),
clientAuthenticationOptions: CreateClientAuthenticationOptions(rootCA));
// Create an invocation pipeline and install the compressor interceptor.
Pipeline pipeline = new Pipeline()
.UseCompressor(CompressionFormat.Brotli)
.Into(connection);
- See Also