Path: blob/dev/pkg/tmplexec/multiproto/README.md
2846 views
multi protocol execution
Implementation
when template is unmarshalled, if it uses more than one protocol, then order of protocols is preserved and is same is passed to Executor multiproto is engine/backend for TemplateExecutor which takes care of sharing logic between protocols and executing them in order
Execution
when multiprotocol template is executed , all protocol requests present in Queue are executed in order and dynamic values extracted are added to template context.
Protocol Responses apart from extracted
internal:truevalues response fields/values of protocol are added to template context atExecutorOptions.TemplateCtxwhich takes care of sync and other issues if any. all response fields are prefixed with template type prefix ex:ssl_subject_dn
Adding New Protocol to multiprotocol execution logic
while logic/implementation of multiprotocol execution is abstracted. it requires 3 statements to be added in newly implemented protocol to make response fields of that protocol available to global context
Add
request.options.GetTemplateCtx(f.input.MetaInput).GetAll()to variablesMap inExecuteWithResultsMethod just aboverequest.options.Variables.Evaluate
Add all response fields to template context just after response map is available
Append all available template context values to outputEvent
adding these 3 statements takes care of all logic related to multiprotocol execution
Exceptions
statements 1 & 2 are intentionally skipped in
fileprotocol to avoid redundant datafile/dir input paths don't contain variables or are used in path (yet)
since files are processed by scanning each line. adding statement 2 will unintentionally load all file(s) data