コード例 #1
0
        protected void OnModelCreated(object modelId)
        {
            var model = LoadModel(modelId);

            _models.Add(model);
            ModelCreated?.Invoke(this, new ModelEventArgs <TModel>(model));
        }
コード例 #2
0
        public void EnsureChannelAvailable()
        {
            if (_disposed)
            {
                _channel = null;
                return;
            }
            if (_channel?.IsOpen != true)
            {
                Logger.LogDebug("Creating a model.");

                _channel = _connectionProvider.Connection.CreateModel();
                ModelCreated?.Invoke(this, new ModelCreatedEventArgs(_channel));

                _channel.BasicAcks  += (channel, args) => BasicAcks?.Invoke(channel, args);
                _channel.BasicNacks += (channel, args) => BasicNacks?.Invoke(channel, args);

                _channel.ConfirmSelect();   // manual (N)ACK
                Logger.LogDebug("Model created.");
            }
        }