/// <summary> /// Resolve correct step by actorid & actor service by current flow. /// </summary> /// <param name="actionName"></param> /// <param name="actorId"></param> /// <param name="occurrence"></param> /// <returns></returns> protected Task <Step> ResolveStepByActorIdAsync(string actorService, string actorId, int occurrence = 0) { CurrentRefStep = Flow.GetCurrentStep(CurrentActorIdentityWithName(null), false, occurrence); NextStep = Flow.GetNextStep(CurrentRefStep); Orders = NextStep.Orders; return(Task.FromResult(CurrentRefStep)); }
/// <summary> /// Resolve the correct flow by name. Used when multiple flows are being used /// </summary> /// <param name="flowName"></param> /// <returns></returns> /// /* * protected Task<Common.Flow.Flow> ResolveFlowAsync(string flowName) * { * Flow = BaseDependencyResolver.ResolveFlow(flowName); * return Task.FromResult(Flow); * }*/ /// <summary> /// Resolve correct step by current flow. /// </summary> /// <param name="actionName"></param> /// <param name="actorId"></param> /// <param name="occurrence"></param> /// <returns></returns> protected Task <Step> ResolveStepAsync(string actionName, int occurrence = 0) { CurrentRefStep = Flow.GetCurrentStep(CurrentActorIdentityWithName(actionName), true, occurrence); NextStep = Flow.GetNextStep(CurrentRefStep); Orders = NextStep.Orders; return(Task.FromResult(CurrentRefStep)); }
protected BaseMessagingActor(ActorService actorService, ActorId actorId, IBinaryMessageSerializer binaryMessageSerializer, IActorClient actorClient, IKeyValueStorage <string> storage, ILogger logger) : base(actorService, actorId, logger) { /* * Flow = BaseDependencyResolver.ResolveFlow(); * if (Flow != null) * { * CurrentRefStep = Flow.GetCurrentStep(CurrentActorServiceWithActorIdNotSpecified); * NextStep = Flow.GetNextStep(CurrentRefStep); * Orders = NextStep.Orders; * }*/ Orders = OrchestrationOrderCollection.NoOrder(); //resolve binary serializer BinaryMessageSerializer = binaryMessageSerializer ?? throw new ArgumentNullException(nameof(binaryMessageSerializer)); ActorClient = actorClient ?? throw new ArgumentNullException(nameof(actorClient)); StorageService = storage; //resolve storage //StorageService = BaseDependencyResolver.ResolveStorageService<string>(); //resolve flowservice //AsyncFlowService = BaseDependencyResolver.ResolveFlowService(); //resolve actorclient to be able to chain next }
/* * protected Common.Flow.Flow RegisterFlow(string keyName) * { * Flow = BaseDependencyResolver.ResolveFlow(keyName); * if (Flow != null) * { * CurrentRefStep = Flow.GetCurrentStep(CurrentActorServiceWithActorIdNotSpecified); * NextStep = Flow.GetNextStep(CurrentRefStep); * Orders = NextStep.Orders; * } * return Flow; * }*/ /// <summary> /// For custom resolve step before going next step /// </summary> /// <param name="actionName"></param> /// <param name="actorId"></param> /// <param name="occurrence"></param> /// <returns></returns> protected Step ResolveStep(string actionName, string actorId = null, int occurrence = 0) { if (string.IsNullOrEmpty(actionName)) { // if having actorId then need to resolve with the correct id ActorIdentityWithActionName actorIdentityWithActionName = CurrentActorIdentityWithName(actionName); if (string.IsNullOrEmpty(actorId)) { actorIdentityWithActionName.ActorId = actorId; } CurrentRefStep = Flow.GetCurrentStep(actorIdentityWithActionName, true, occurrence); NextStep = Flow.GetNextStep(CurrentRefStep); Orders = NextStep.Orders; } else // no need action name to resolve { CurrentRefStep = Flow.GetCurrentStep(CurrentActorServiceWithActorIdNotSpecified); NextStep = Flow.GetNextStep(CurrentRefStep); Orders = NextStep.Orders; } return(CurrentRefStep); }
get => new EndStep() { Id = new StepId(END_STEP_GUID), Orders = OrchestrationOrderCollection.NoOrder() }; }
get => new NoStep() { Id = new StepId(NO_STEP_GUID), Orders = OrchestrationOrderCollection.NoOrder() }; }
public Step() { Id = new StepId(Guid.NewGuid().ToString()); Orders = OrchestrationOrderCollection.NoOrder(); StepType = StepType.Normal; }