コード例 #1
0
        public TopicMessageBus(
            string connectionString,
            int partitionCount,
            int nodeCount,
            int nodeId,
            string prefix,
            Func <string, ulong, Message[], Task> onReceivedAsync)
        {
            this.prefix           = prefix;
            this.connectionString = connectionString;
            this.partitionCount   = partitionCount;
            this.nodeCount        = nodeCount;
            this.nodeId           = nodeId;

            this.factories       = new Dictionary <int, MessagingFactory>();
            this.pumps           = new Dictionary <int, MessagePump>();
            this.senders         = new Dictionary <int, MessageSender>();
            this.onReceivedAsync = onReceivedAsync;

            this.semaphore  = new AsyncSemaphore(MaxInputQueueLength);
            this.inputQueue = new InputQueue <InternalMessage>();

            this.initializeTask = Task.Factory.FromAsync(
                (c, s) => new InitializeAsyncResult(this, c, s).Start(),
                r => { InitializeAsyncResult.End(r); return(true); },
                null);
        }
コード例 #2
0
ファイル: MessagePump.cs プロジェクト: yashhotline/SignalR
        public MessagePump(string id, MessageReceiver receiver, InputQueue <InternalMessage> inputQueue, AsyncSemaphore semaphore)
        {
            this.id         = id;
            this.receiver   = receiver;
            this.inputQueue = inputQueue;
            this.semaphore  = semaphore;

            this.exitSemaphore = new Action(ExitSemaphore);
        }
コード例 #3
0
 public AsyncQueueReader(InputQueue <T> inputQueue, TimeSpan timeout, AsyncCallback callback, object state)
     : base(callback, state)
 {
     if (inputQueue.AsyncCallbackGenerator != null)
     {
         this.VirtualCallback = new Action <AsyncCallback, IAsyncResult>(inputQueue.AsyncCallbackGenerator());
     }
     this.inputQueue = inputQueue;
     if (timeout != TimeSpan.MaxValue)
     {
         this.timer = new IOThreadTimer(timerCallback, this, false);
         this.timer.Set(timeout);
     }
 }
コード例 #4
0
 public WaitQueueReader(InputQueue <T> inputQueue)
 {
     this.inputQueue = inputQueue;
     waitEvent       = new ManualResetEvent(false);
 }
コード例 #5
0
 public MessageDispatcher(InputQueue <InternalMessage> inputQueue, Func <string, ulong, Message[], Task> onReceivedAsync)
 {
     this.inputQueue      = inputQueue;
     this.onReceivedAsync = onReceivedAsync;
 }