Пример #1
0
 public AsyncMessageBrokerCore(MessagePipeDiagnosticsInfo diagnotics, MessagePipeOptions options)
 {
     this.handlers = new FreeList <IAsyncMessageHandler <TMessage> >();
     this.defaultAsyncPublishStrategy     = options.DefaultAsyncPublishStrategy;
     this.handlingSubscribeDisposedPolicy = options.HandlingSubscribeDisposedPolicy;
     this.diagnotics = diagnotics;
 }
Пример #2
0
 public MessageBrokerCore(MessagePipeDiagnosticsInfo diagnotics, MessagePipeOptions options)
 {
     this.handlerGroup = new Dictionary <TKey, HandlerHolder>();
     this.diagnotics   = diagnotics;
     this.handlingSubscribeDisposedPolicy = options.HandlingSubscribeDisposedPolicy;
     this.gate = new object();
 }
Пример #3
0
 async void RunTimer(MessagePipeDiagnosticsInfo diagnosticsInfo)
 {
     while (!cts.IsCancellationRequested)
     {
         // show SubscribeCount
         Console.WriteLine(diagnosticsInfo.SubscribeCount);
         await Task.Delay(TimeSpan.FromSeconds(5), cts.Token);
     }
 }
Пример #4
0
 public EventFactory(
     MessagePipeOptions options,
     MessagePipeDiagnosticsInfo diagnosticsInfo,
     FilterAttachedMessageHandlerFactory handlerFactory,
     FilterAttachedAsyncMessageHandlerFactory asyncHandlerFactory)
 {
     this.options             = options;
     this.diagnosticsInfo     = diagnosticsInfo;
     this.handlerFactory      = handlerFactory;
     this.asyncHandlerFactory = asyncHandlerFactory;
 }
Пример #5
0
        public Program(
            IPublisher <string, MyMessage> publisher,
            ISubscriber <string, MyMessage> subscriber,
            IPublisher <MyMessage> keyless1,
            ISubscriber <MyMessage> keyless2,

            IAsyncPublisher <MyMessage> asyncKeylessP,
            IAsyncSubscriber <MyMessage> asyncKeylessS,

            IRequestHandler <Ping, Pong> pingponghandler,
            //PingHandler pingpingHandler,
            IRequestAllHandler <Ping, Pong> pingallhandler,

            IPublisher <int> intP,
            ISubscriber <int> intS,
            IServiceScopeFactory scopeF,
            MessagePipeDiagnosticsInfo diagnosticsInfo,

            IServiceProvider provider


            )
        {
            this.provider        = provider;
            this.scopeF          = scopeF;
            this.publisher       = publisher;
            this.subscriber      = subscriber;
            this.keylessP        = keyless1;
            this.keylessS        = keyless2;
            this.asyncKeylessP   = asyncKeylessP;
            this.asyncKeylessS   = asyncKeylessS;
            this.pingponghandler = pingponghandler;
            //this.pingpingHandler = pingpingHandler;
            this.pingallhandler  = pingallhandler;
            this.intPublisher    = intP;
            this.intSubscriber   = intS;
            this.diagnosticsInfo = diagnosticsInfo;

            var r1 = provider.GetRequiredService <IRequestHandler <string, int> >();

            r1.Invoke("foo");
        }
Пример #6
0
 public MessageBrokerCore(MessagePipeDiagnosticsInfo diagnotics, MessagePipeOptions options)
 {
     this.handlers = new FreeList <IMessageHandler <TMessage> >();
     this.handlingSubscribeDisposedPolicy = options.HandlingSubscribeDisposedPolicy;
     this.diagnotics = diagnotics;
 }
Пример #7
0
 public ScopedAsyncMessageBrokerCore(MessagePipeDiagnosticsInfo diagnotics, MessagePipeOptions options)
     : base(diagnotics, options)
 {
 }
Пример #8
0
 public MonitorTimer(MessagePipeDiagnosticsInfo diagnosticsInfo)
 {
     RunTimer(diagnosticsInfo);
 }
Пример #9
0
 public SingletonMessageBrokerCore(MessagePipeDiagnosticsInfo diagnotics, MessagePipeOptions options)
     : base(diagnotics, options)
 {
 }
Пример #10
0
 public static void SetProvider(IServiceProvider provider)
 {
     GlobalMessagePipe.provider        = provider;
     GlobalMessagePipe.eventFactory    = provider.GetRequiredService <EventFactory>();
     GlobalMessagePipe.diagnosticsInfo = provider.GetRequiredService <MessagePipeDiagnosticsInfo>();
 }