protected void OnModelCreated(object modelId) { var model = LoadModel(modelId); _models.Add(model); ModelCreated?.Invoke(this, new ModelEventArgs <TModel>(model)); }
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."); } }