本文整理汇总了C#中Pipe.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Pipe.Send方法的具体用法?C# Pipe.Send怎么用?C# Pipe.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipe
的用法示例。
在下文中一共展示了Pipe.Send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bind
public void Bind(Pipe pipe)
{
base.Visit(pipe);
if (!_bound)
throw new PipelineException("Could not bind pipe: " + _segment.SegmentType + "(" + _segment.MessageType + ")");
pipe.Send(new SubscriberAdded {MessageType = _messageType});
}
示例2: SendMessage
/// <summary>
/// Send Message
/// </summary>
private void SendMessage()
{
// We get here if Completed() is called for the first time.
// Need to send special message to DeleteProjectCleanup worker.
var pipelineSection = FindPipelineSection("DeleteProjectCleanup");
var dataPipeName = pipelineSection.DataPipeName;
using (var dataPipe = new Pipe(dataPipeName))
{
dataPipe.Open();
var envelope = new PipeMessageEnvelope() { Label = "PleaseCleanup" };
dataPipe.Send(envelope);
}
_finalizationRequested = true;
}
示例3: How_many_messages_can_the_pipe_send_per_second
public void How_many_messages_can_the_pipe_send_per_second()
{
_count = 0;
_count2 = 0;
_limit = 5000000;
Pipe consumer = PipeSegment.Consumer<ClaimModified>(m => { Interlocked.Increment(ref _count); });
Pipe consumer2 = PipeSegment.Consumer<ClaimModified>(m => { Interlocked.Increment(ref _count2); });
var recipients = new[] {consumer, consumer2};
Pipe recipientList = PipeSegment.RecipientList<ClaimModified>(recipients);
Pipe filter = PipeSegment.Filter<object>(recipientList);
Pipe objectRecipientList = PipeSegment.RecipientList<object>(new[] {filter});
_input = PipeSegment.Input(objectRecipientList);
var message = new ClaimModified();
for (int i = 0; i < 100; i++)
{
_input.Send(message);
}
_count = 0;
_count2 = 0;
Thread pusherThread = new Thread(Pusher);
Thread pusherThread2 = new Thread(Pusher);
Stopwatch timer = Stopwatch.StartNew();
pusherThread.Start();
pusherThread2.Start();
pusherThread.Join(10000);
pusherThread2.Join(1000);
timer.Stop();
Trace.WriteLine("Received: " + (_count + _count2) + ", expected " + _limit*2);
Trace.WriteLine("Elapsed Time: " + timer.ElapsedMilliseconds + "ms");
Trace.WriteLine("Messages Per Second: " + _limit*1000/timer.ElapsedMilliseconds);
}
示例4: AddPipe
public void AddPipe(Pipe pipe)
{
Pipes.Add (pipe);
pipe.Send (Exchange.Handshake (0x1a));
}
示例5: First_example
public void First_example()
{
_eventAggregator = PipeSegment.Input(PipeSegment.End());
_eventAggregator.Send(new CustomerRatingDowngraded());
}