public override ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder( string processorName, ChangeFeedStreamHandler onChangesDelegate) { return(this.container.GetChangeFeedProcessorBuilder( processorName, async( ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken) => { Stream decryptedChanges = await EncryptionProcessor.DeserializeAndDecryptResponseAsync( changes, this.Encryptor, cancellationToken); // Call the original passed in delegate await onChangesDelegate(context, decryptedChanges, cancellationToken); })); }
public override async Task <ResponseMessage> ReadNextAsync(CancellationToken cancellationToken = default) { CosmosDiagnosticsContext diagnosticsContext = CosmosDiagnosticsContext.Create(options: null); using (diagnosticsContext.CreateScope("FeedIterator.ReadNext")) { ResponseMessage responseMessage = await this.feedIterator.ReadNextAsync(cancellationToken); if (responseMessage.IsSuccessStatusCode && responseMessage.Content != null) { Stream decryptedContent = await EncryptionProcessor.DeserializeAndDecryptResponseAsync( responseMessage.Content, this.encryptor, cancellationToken); return(new DecryptedResponseMessage(responseMessage, decryptedContent)); } return(responseMessage); } }