Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonExporter"/> class.
 /// </summary>
 /// <param name="pipeline">The pipeline that owns this instance.</param>
 /// <param name="writer">The underlying store writer.</param>
 protected JsonExporter(Pipeline pipeline, JsonStoreWriter writer)
 {
     this.pipeline    = pipeline;
     this.writer      = writer;
     this.merger      = new Merger <Message <JToken>, string>(pipeline);
     this.writerInput = pipeline.CreateReceiver <Message <JToken> >(this, (m, e) => this.writer.Write(m.Data, m.Envelope), nameof(this.writerInput));
     this.merger.Select(this.ThrottledMessages).PipeTo(this.writerInput, DeliveryPolicy.Unlimited);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonExporter"/> class.
 /// </summary>
 /// <param name="pipeline">The pipeline that owns this instance.</param>
 /// <param name="writer">The underlying store writer.</param>
 protected JsonExporter(Pipeline pipeline, JsonStoreWriter writer)
     : base(pipeline)
 {
     this.pipeline = pipeline;
     this.writer   = writer;
     this.merger   = new Merger <Message <JToken>, string>(pipeline, (_, m) =>
     {
         this.throttle.WaitOne();
         this.writer.Write(m.Data.Data, m.Data.Envelope);
     });
 }