/// <summary> /// Initializes a new instance of the <see cref="Agent"/> class. /// </summary> /// <param name="config">The config to add metadata to the agent.</param> /// <param name="receiver">The receiver on which the agent should listen for messages.</param> /// <param name="transformerConfig">The config to create <see cref="ITransformer"/> instances.</param> /// <param name="exceptionHandler">The handler to handle failures during the agent execution.</param> /// <param name="stepConfiguration">The config to create <see cref="IStep"/> normal & error pipelines.</param> internal Agent( AgentConfig config, IReceiver receiver, Transformer transformerConfig, IAgentExceptionHandler exceptionHandler, StepConfiguration stepConfiguration) : this(config, receiver, transformerConfig, exceptionHandler, stepConfiguration, NoopJournalLogger.Instance) { }
/// <summary> /// Initializes a new instance of the <see cref="Agent"/> class. /// </summary> /// <param name="config">The config to add metadata to the agent.</param> /// <param name="receiver">The receiver on which the agent should listen for messages.</param> /// <param name="transformerConfig">The config to create <see cref="ITransformer"/> instances.</param> /// <param name="exceptionHandler">The handler to handle failures during the agent execution.</param> /// <param name="stepConfiguration">The config to create <see cref="IStep"/> normal & error pipelines.</param> /// <param name="journalLogger">The logging implementation to write journal log entries for handled messages.</param> internal Agent( AgentConfig config, IReceiver receiver, Transformer transformerConfig, IAgentExceptionHandler exceptionHandler, StepConfiguration stepConfiguration, IJournalLogger journalLogger) { if (config == null) { throw new ArgumentNullException(nameof(config)); } if (receiver == null) { throw new ArgumentNullException(nameof(receiver)); } if (transformerConfig == null) { throw new ArgumentNullException(nameof(transformerConfig)); } if (exceptionHandler == null) { throw new ArgumentNullException(nameof(exceptionHandler)); } if (stepConfiguration == null) { throw new ArgumentNullException(nameof(stepConfiguration)); } _receiver = receiver; _transformerConfig = transformerConfig; _exceptionHandler = exceptionHandler; _steps = new StepExecutioner(stepConfiguration, exceptionHandler); _journalLogger = journalLogger ?? NoopJournalLogger.Instance; AgentConfig = config; }
/// <summary> /// Initializes a new instance of the <see cref="Agent"/> class. /// </summary> /// <param name="config">The config to add meta data information to the agent.</param> /// <param name="receiver">The receiver on which the agent should listen for messages.</param> /// <param name="transformerConfig">The config to create <see cref="ITransformer"/> instances.</param> /// <param name="exceptionHandler">The handler to handle failures during the agent execution.</param> /// <param name="pipelineConfig">The config to create <see cref="IStep"/> normal & error pipelines.</param> /// <remarks>This should only be used inside a 'Minder' scenario!</remarks> internal Agent( AgentConfig config, IReceiver receiver, Transformer transformerConfig, IAgentExceptionHandler exceptionHandler, (ConditionalStepConfig happyPath, ConditionalStepConfig unhappyPath) pipelineConfig)