Beispiel #1
0
 public ConcurrentConsumerDispatcher(ModelBase model, ConsumerWorkService ws)
 {
     this.model       = model;
     this.workService = ws;
     this.workService.RegisterKey(model);
     this.IsShutdown = false;
 }
Beispiel #2
0
        protected ModelBase(ISession session, ConsumerWorkService workService)
        {
            if (workService is AsyncConsumerWorkService asyncConsumerWorkService)
            {
                ConsumerDispatcher = new AsyncConsumerDispatcher(this, asyncConsumerWorkService);
            }
            else
            {
                ConsumerDispatcher = new ConcurrentConsumerDispatcher(this, workService);
            }

            _emptyBasicProperties = CreateBasicProperties();
            Action <Exception, string> onException = (exception, context) => OnCallbackException(CallbackExceptionEventArgs.Build(exception, context));

            _basicAcksWrapper         = new EventingWrapper <BasicAckEventArgs>("OnBasicAck", onException);
            _basicNacksWrapper        = new EventingWrapper <BasicNackEventArgs>("OnBasicNack", onException);
            _basicRecoverOkWrapper    = new EventingWrapper <EventArgs>("OnBasicRecover", onException);
            _basicReturnWrapper       = new EventingWrapper <BasicReturnEventArgs>("OnBasicReturn", onException);
            _callbackExceptionWrapper = new EventingWrapper <CallbackExceptionEventArgs>(string.Empty, (exception, context) => { });
            _flowControlWrapper       = new EventingWrapper <FlowControlEventArgs>("OnFlowControl", onException);
            _modelShutdownWrapper     = new EventingWrapper <ShutdownEventArgs>("OnModelShutdown", onException);
            _recoveryWrapper          = new EventingWrapper <EventArgs>("OnModelRecovery", onException);
            Initialise(session);
        }
Beispiel #3
0
 public AsyncConsumerDispatcher(ModelBase model, ConsumerWorkService ws)
 {
     this.model       = model;
     this.workService = ws;
     this.IsShutdown  = false;
 }
Beispiel #4
0
 public ConcurrentConsumerDispatcher(ModelBase model, ConsumerWorkService ws)
 {
     this.model  = model;
     workService = ws;
     IsShutdown  = false;
 }