예제 #1
0
        public CoreHost(IServiceProvider serviceProvider, ICoreDispatcher dispatcher, IHealthcheck healthcheck, ICoreConnection coreConnection, IApplicationLifetime appLifetime)
        {
            _appLifetime = appLifetime ?? throw new CoreException("AppLifetime not defined");

            _serviceProvider = serviceProvider ?? throw new CoreException("ServiceProvider not defined");
            _coreConnection  = coreConnection ?? throw new CoreException("CoreConnection not defined");
            _healthcheck     = healthcheck ?? throw new CoreException("Healthcheck not defined");
            _dispatcher      = dispatcher ?? throw new CoreException("CoreDispatcher not defined");

            //SIG handlers
            appLifetime.ApplicationStarted.Register(OnStarted);
            appLifetime.ApplicationStopping.Register(OnStopping);
            appLifetime.ApplicationStopped.Register(OnStopped);
        }
예제 #2
0
        public MessageEntry(ICoreDispatcher dispatcher, ReceivedMessageEventArgs receivedMessage)
        {
            ReceivedMessage = receivedMessage;

            Dispatcher = dispatcher;

            if (receivedMessage != null)
            {
                _via = receivedMessage.GetVia();

                IsRequest = receivedMessage.GetHeaderValue(MessageBasicPropertiesHeaders.DIRECTION) != MessageBasicPropertiesHeaders.DIRECTION_VALUE_RESPONSE;
                if (_via == null)
                {
                    _via = new ViaContainer()
                    {
                        queue = new Stack <ViaElement>()
                    };

                    if (receivedMessage.Properties != null)
                    {
                        _via.queue.Push(new ViaElement()
                        {
                            appId            = receivedMessage.Properties.AppId,
                            messageId        = receivedMessage.Properties.MessageId,
                            mqWorkKind       = ExchangeTypes.Get(receivedMessage.GetHeaderValue(MessageBasicPropertiesHeaders.WORKKIND)) ?? ExchangeTypes.EXCHANGETYPE_FANOUT,
                            priority         = receivedMessage.Properties.Priority,
                            queryHandlerName = receivedMessage.Properties.ContentType,
                            replyTo          = receivedMessage.Properties.ReplyTo
                        });
                    }
                }
            }
            else
            {
                _via = new ViaContainer()
                {
                    queue = new Stack <ViaElement>()
                };
            }
        }
예제 #3
0
 public MessageSenderBase(ICoreDispatcher dispatcher)
 {
     _dispatcher = dispatcher;
 }
예제 #4
0
 public QueryHandlerBase(ICoreDispatcher dispatcher) : base(dispatcher)
 {
     this._dispatcher = dispatcher;
 }
예제 #5
0
 public ResponseHandlerBase(ICoreDispatcher dispatcher) : base(dispatcher)
 {
     this._dispatcher = dispatcher;
 }
예제 #6
0
 public MyTestService(ICoreDispatcher dispatcher, IPrepareConfigService config) : base(dispatcher)
 {
     this.config = config;
 }
예제 #7
0
 public MyResponseHanlder(ICoreDispatcher dispatcher) : base(dispatcher)
 {
 }
예제 #8
0
 public MyQueryHanlder(ICoreDispatcher dispatcher) : base(dispatcher)
 {
 }