/// <summary>
        /// Initiate a command step
        /// </summary>
        /// <param name="stepName">
        /// The name of the step to run
        /// </param>
        /// <param name="targetDomain">
        /// The domain of the entity on which the command is to be executed
        /// </param>
        /// <param name="targetEntityType">
        /// The type of the entity on which the command isw to be executed
        /// </param>
        /// <param name="targetEntityInstance">
        /// The unique instance of the entity on which the command is to be executed
        /// </param>
        public async Task InitiateStep(string stepName,
                                       string targetDomain         = "",
                                       string targetEntityType     = "",
                                       string targetEntityInstance = "")
        {
            if (!string.IsNullOrWhiteSpace(stepName))
            {
                EventStream esCmd = new EventStream(new EventStreamAttribute(MakeDomainCommandName(DomainName),
                                                                             CommandName,
                                                                             UniqueIdentifier,
                                                                             notificationDispatcherName: _commandDispatcherName),
                                                    context: _commandContext);

                CommandStepInitiated evStep = new CommandStepInitiated()
                {
                    StepName       = stepName,
                    DomainName     = targetDomain,
                    EntityTypeName = targetEntityType,
                    InstanceKey    = targetEntityInstance
                };

                await esCmd.AppendEvent(evStep);
            }

            if (_commandListener != null)
            {
                // TODO : Use the listener / executor to run the command step
            }
        }
 public void HandleEventInstance(CommandStepInitiated eventInstance)
 {
     if (null != eventInstance)
     {
         _currentStatus = STATUS_RUNNING;
         _message       = $"Running {eventInstance.StepName}";
     }
 }
Exemple #3
0
        /// <summary>
        /// Initiate a command step
        /// </summary>
        /// <param name="stepName">
        /// The name of the step to run
        /// </param>
        public async Task InitiateStep(string stepName,
                                       string targetDomain         = "",
                                       string targetEntityType     = "",
                                       string targetEntityInstance = "")
        {
            if (!string.IsNullOrWhiteSpace(stepName))
            {
                EventStream esCmd = new EventStream(new EventStreamAttribute(MakeDomainCommandName(DomainName),
                                                                             CommandName,
                                                                             UniqueIdentifier),
                                                    context: _commandContext);

                CommandStepInitiated evStep = new CommandStepInitiated()
                {
                    StepName       = stepName,
                    DomainName     = targetDomain,
                    EntityTypeName = targetEntityType,
                    InstanceKey    = targetEntityInstance
                };

                await esCmd.AppendEvent(evStep);
            }
        }