public LogImpl(DateTime date, EventType eventType, IFlow flow) { this._date = date; this._eventType = eventType; this._flow = flow; this._details = new ListSet(); }
public ProcessInstanceImpl(String actorId, ProcessDefinitionImpl processDefinition) { this._start = DateTime.Now; this._initiatorActorId = actorId; this._processDefinition = processDefinition; this._rootFlow = new FlowImpl(actorId, this); }
public LogImpl(String actorId, DateTime date, EventType eventType, IFlow flow) { this._actorId = actorId; this._date = date; this._eventType = eventType; this._flow = flow; this._details = new ListSet(); }
public ActivityFormImpl(FlowImpl flow, IList fields, IDictionary attributeValues) { this._flow = flow; this._processInstance = flow.ProcessInstance; this._processDefinition = _processInstance.ProcessDefinition; this._activityState = (IActivityState) flow.Node; this._fields = fields; this._attributeValues = attributeValues; InitTransitionNames(flow.Node); }
private void WriteFlow(TextWriter logDetail, IFlow flow) { WriteFlowStart(logDetail, flow); IEnumerator iter = flow.Logs.GetEnumerator(); //@todo add sort see http://www.koders.com/csharp/fid7483E2E4A14A57A929B3D9338410A60E4E911842.aspx?s=sort while (iter.MoveNext()) { ILog eventLog = (ILog) iter.Current; WriteFlowEvent(logDetail, eventLog, flow); } WriteFlowEnd(logDetail, flow); }
public FlowImpl(String name, FlowImpl parent, ProcessBlockImpl processBlock) { this._name = name; this._start = DateTime.Now; this._processInstance = parent.ProcessInstance; this._subProcessInstances = null; this._parent = parent; this._children = null; this._logs = new ListSet(); this._parentReactivation = true; CreateAttributeInstances(processBlock.Attributes); }
public JobImpl(Job job, String reference) { _processDefinition = job.ProcessDefinition; _context = job.Context; _date = job.Date; _userId = job.UserId; _pwd = job.Pwd; this._reference = reference; _actionDelegation = new DelegationImpl(); _actionDelegation.ProcessDefinition = job.ProcessDefinition; _actionDelegation.ClassName = job.TaskClassName; _actionDelegation.Configuration = job.Configuration; }
public FlowImpl(String actorId, ProcessInstanceImpl processInstance) { ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) processInstance.ProcessDefinition; this._name = "root"; this._actorId = actorId; this._start = DateTime.Now; this._node = processDefinition.StartState; this._processInstance = processInstance; this._subProcessInstances = null; this._parent = null; this._children = null; this._logs = new ListSet(); this._parentReactivation = true; CreateAttributeInstances(processDefinition.Attributes); }
private void WriterAttributes(IFlow flow, StreamWriter xmlwriter) { //NHibernate.LazyInitializationException: Failed to lazily initialize a collection - no session IEnumerator iter = flow.AttributeInstances.GetEnumerator(); while (iter.MoveNext()) { IAttributeInstance attributeInstance = (IAttributeInstance)iter.Current; xmlwriter.WriteLine(" <attribute type=\"AT_UDA_12_"+attributeInstance.Attribute.Name+"\">"+attributeInstance.GetValue()+"</attribute>"); } // recursively descend to the children iter = flow.Children.GetEnumerator(); while (iter.MoveNext()) { WriterAttributes((IFlow) iter.Current,xmlwriter); } }
public AttributeInstanceImpl(AttributeImpl attribute, FlowImpl scope) { this._valueText = attribute.InitialValue; this._attribute = attribute; this._scope = scope; }
/// <summary> /// Provides a single flow to execute as the job. /// </summary> /// <param name="flow"></param> /// <returns></returns> public FlowJobBuilder Flow(IFlow flow) { _flow = flow; return this; }
/// <summary> /// Custom constructor using a flow and a name. /// </summary> /// <param name="flow"></param> /// <param name="name"></param> public FlowState(IFlow flow, string name) : base(name) { _flow = flow; }
public ActionResult ShowHome(String preview, Int32 processDefinitionId, Int32 flowId) { IDefinitionSessionLocal definitionComponent = null; IExecutionSessionLocal executionComponent = null; try { definitionComponent = ServiceLocator.Instance.GetService(typeof(IDefinitionSessionLocal)) as IDefinitionSessionLocal; executionComponent = ServiceLocator.Instance.GetService(typeof(IExecutionSessionLocal)) as IExecutionSessionLocal; IList taskList = executionComponent.GetTaskList(); IList processDefinitions = definitionComponent.GetProcessDefinitions(); if (preview != null) { if (preview.Equals("process")) { if (processDefinitionId == 0) { ArrayList errors = new ArrayList(); errors.Add("when parameter 'preview' is equal to 'process', a valid parameter 'processDefinitionId' should be provided as well,"); ViewData["errormessages"] = errors; //Context.Flash["errormessages"] = errors; } IProcessDefinition processDefinition = null; // Get the processDefinition processDefinition = definitionComponent.GetProcessDefinition(processDefinitionId); ViewData["processDefinition"] = processDefinition; //Context.Flash["processDefinition"] = processDefinition; } else if (preview.Equals("activity")) { if (flowId == 0) { ArrayList errors = new ArrayList(); errors.Add("when parameter 'preview' is equal to 'activity', a valid parameter 'flowId' should be provided as well,"); ViewData["errormessages"] = errors; //Context.Flash["errormessages"] = errors; } // IFlow flow = executionComponent.GetFlow(flowId, new Relations(new System.String[]{"processInstance.processDefinition"})); IFlow flow = executionComponent.GetFlow(flowId); ViewData["activity"] = flow.Node; //Context.Flash["activity"] = flow.Node; //AddImageCoordinates((IState)flow.Node); ViewData["processDefinition"] = flow.ProcessInstance.ProcessDefinition; //Context.Flash["processDefinition"] = flow.ProcessInstance.ProcessDefinition; } } ViewData["taskList"] = taskList; ViewData["processDefinitions"] = processDefinitions; ViewData["preview"] = preview; //Context.Flash["taskList"] = taskList; //Context.Flash["processDefinitions"] = processDefinitions; //Context.Flash["preview"] = preview; } finally { ServiceLocator.Instance.Release(executionComponent); ServiceLocator.Instance.Release(definitionComponent); } return(View()); }
private void GetStateAndAttributes(IList state, IList attributeRows, String indentation, IFlow flow) { // add the flow to the state IEnumerator iter = flow.Children.GetEnumerator(); while (iter.MoveNext()) { state.Add(iter.Current); } // add the flow-name to the attributeRows System.Collections.IDictionary row = new System.Collections.Hashtable(); if (flow.IsRootFlow()) { row["name"] = indentation + "rootflow <b>[</b>" + flow.Name + "<b>]</b>"; } else { row["name"] = indentation + "subflow <b>[</b>" + flow.Name + "<b>]</b>"; } row["value"] = ""; attributeRows.Add(row); // add the flow-local attributes to the attributeRows iter = flow.AttributeInstances.GetEnumerator(); while (iter.MoveNext()) { IAttributeInstance attributeInstance = (IAttributeInstance) iter.Current; row = new Hashtable(); log.Debug("adding attribute instance value " + attributeInstance.GetValue()); row["name"] = indentation + " +- <b>[</b>" + attributeInstance.Attribute.Name + "<b>]</b>"; row["value"] = attributeInstance.GetValue(); attributeRows.Add(row); } // recursively descend to the children iter = flow.Children.GetEnumerator(); while (iter.MoveNext()) { GetStateAndAttributes(state, attributeRows, indentation + " | ", (IFlow) iter.Current); } IProcessInstance processInstance = flow.GetSubProcessInstance(); if (processInstance != null) { state.Add(processInstance.RootFlow); GetStateAndAttributes(state, attributeRows, indentation + " | ", processInstance.RootFlow); } }
/// <summary> /// /// </summary> /// <param name="flow"></param> /// <param name="map"></param> private void FindSteps(IFlow flow, IDictionary<string, IStep> map) { foreach (IState state in flow.GetStates()) { var stepLocator = state as IStepLocator; if (stepLocator != null) { IStepLocator locator = stepLocator; foreach (string name in locator.GetStepNames()) { map.Add(name, locator.GetStep(name)); } } else { var holder = state as IStepHolder; if (holder != null) { IStep step = holder.Step; string name = step.Name; _stepMap.Add(name, step); } else { var flowHolder = state as IFlowHolder; if (flowHolder != null) { foreach (IFlow subflow in flowHolder.GetFlows()) { FindSteps(subflow, map); } } } } } }
void Run(IContext context, string host) { // Validate parameters if (context == null) { throw new ArgumentException("Solace Systems API context Router must be not null.", "context"); } if (string.IsNullOrWhiteSpace(host)) { throw new ArgumentException("Solace Messaging Router host name must be non-empty.", "host"); } if (string.IsNullOrWhiteSpace(VPNName)) { throw new InvalidOperationException("VPN name must be non-empty."); } if (string.IsNullOrWhiteSpace(UserName)) { throw new InvalidOperationException("Client username must be non-empty."); } // Create session properties SessionProperties sessionProps = new SessionProperties() { Host = host, VPNName = VPNName, UserName = UserName, Password = Password, CompressionLevel = 0, // 0..9 for more compression, but only usable against appliance ReconnectRetries = DefaultReconnectRetries }; // Connect to the Solace messaging router Console.WriteLine("Connecting as {0}@{1} on {2}...", UserName, VPNName, host); Session = context.CreateSession(sessionProps, null, null); ReturnCode returnCode = Session.Connect(); if (returnCode == ReturnCode.SOLCLIENT_OK) { Console.WriteLine("Session successfully connected."); // Provision the queue string queueName = "Q/tutorial"; Console.WriteLine("Attempting to provision the queue '{0}'...", queueName); // Set queue permissions to "consume" and access-type to "exclusive" EndpointProperties endpointProps = new EndpointProperties() { Permission = EndpointProperties.EndpointPermission.Consume, AccessType = EndpointProperties.EndpointAccessType.Exclusive }; // Create the queue Queue = ContextFactory.Instance.CreateQueue(queueName); // Provision it, and do not fail if it already exists Session.Provision(Queue, endpointProps, ProvisionFlag.IgnoreErrorIfEndpointAlreadyExists | ProvisionFlag.WaitForConfirm, null); Console.WriteLine("Queue '{0}' has been created and provisioned.", queueName); // Create and start flow to the newly provisioned queue // NOTICE HandleMessageEvent as the message event handler // and HandleFlowEvent as the flow event handler Flow = Session.CreateFlow(new FlowProperties() { AckMode = MessageAckMode.ClientAck }, Queue, null, HandleMessageEvent, HandleFlowEvent); Flow.Start(); Console.WriteLine("Waiting for a message in the queue '{0}'...", queueName); WaitEventWaitHandle.WaitOne(); } else { Console.WriteLine("Error connecting, return code: {0}", returnCode); } }
public override void SampleCall(string[] args) { // Parse arguments and initialize Session properties. ArgParser cmdLineParser = new ArgParser(); if (!cmdLineParser.Parse(args)) { // Parse failed. PrintUsage(INVALID_ARGUMENTS_ERROR); return; } // Create Session properties from the command line options. SessionProperties sessionProps = SampleUtils.NewSessionPropertiesFromConfig(cmdLineParser.Config); try { InitContext(cmdLineParser.LogLevel); // Create and connect 'sessionA' with No Local delivery set to false. sessionProps.NoLocal = false; // No Local is set to 'false' by default. InitializeAndAssertCapabilities(ref context, ref sessionA, "sessionA", sessionProps); // Create and connect 'sessionB' with No Local delivery set to true. sessionProps.NoLocal = true; // <-- this is how we set NoLocal at the session level InitializeAndAssertCapabilities(ref context, ref sessionB, "sessionB", sessionProps); // Create a Flow to a temporary Queue within sessionA. IQueue queue = sessionB.CreateTemporaryQueue(); FlowProperties flowProps = new FlowProperties(); flowProps.NoLocal = true; // <-- this is how we set NoLocal at the flow level flowProps.BindBlocking = true; flowA = sessionA.CreateFlow(flowProps, queue, null, HandleMessageEvent, SampleUtils.HandleFlowEvent); flowA.Start(); // Add a Topic subscription to sessionB. ITopic topic = ContextFactory.Instance.CreateTopic(SampleUtils.SAMPLE_TOPIC); sessionB.Subscribe(topic, true /*wait for confirm*/); // Publish a Direct message to Topic T from each Session; verify it is not delivered locally. IMessage msg = ContextFactory.Instance.CreateMessage(); msg.BinaryAttachment = Encoding.ASCII.GetBytes(SampleUtils.MSG_ATTACHMENTTEXT); msg.Destination = topic; msg.DeliveryMode = MessageDeliveryMode.Direct; // Send from 'sessionA'. Console.WriteLine(string.Format("\nSending a direct message to topic '{0}' from sessionA", topic.ToString())); sessionA.Send(msg); Thread.Sleep(500); PrintCounters(); Console.WriteLine(string.Format("Expecting msgCounterForSessionB to be 1, it's '{0}'", msgCounterForSessionB)); Console.WriteLine(string.Format("Expecting msgCounterForSessionA to be 0, it's '{0}'", msgCounterForSessionA)); ResetCounters(); // Send from 'sessionB'. Console.WriteLine(string.Format("\nSending a direct message to topic '{0}' from sessionB", topic.ToString())); sessionB.Send(msg); Thread.Sleep(500); PrintCounters(); Console.WriteLine(string.Format("Expecting msgCounterForSessionA to be 0, it's '{0}'", msgCounterForSessionA)); Console.WriteLine(string.Format("Expecting msgCounterForSessionB to be 0, it's '{0}'", msgCounterForSessionB)); ResetCounters(); // Publish a message to the Queue on each Session; verify it is not delivered locally. msg.Destination = queue; msg.DeliveryMode = MessageDeliveryMode.Persistent; // Send from 'sessionA'. Console.WriteLine(string.Format("\nSending a persistent message to queue '{0}' from sessionA", queue.ToString())); sessionA.Send(msg); Thread.Sleep(500); PrintCounters(); Console.WriteLine(string.Format("Expecting msgCounterForFlowA to be 0, it's '{0}'", msgCounterForFlowA)); ResetCounters(); // Send from 'sessionB'. Console.WriteLine(string.Format("\nSending a persistent message to queue '{0}' from sessionB", queue.ToString())); sessionB.Send(msg); Thread.Sleep(500); PrintCounters(); Console.WriteLine(string.Format("Expecting msgCounterForFlowA to be 1, it's '{0}'", msgCounterForFlowA)); ResetCounters(); Console.WriteLine("\nDone"); } catch (Exception ex) { PrintException(ex); } finally { if (flowA != null) { flowA.Dispose(); } if (sessionA != null) { sessionA.Dispose(); } if (context != null) { context.Dispose(); } // Must cleanup after. CleanupContext(); } }
public static IFlow <T> Map <S, T>(this IFlow <S> @this, Func <S, T> func) { return(new MapFlow <S, T>(@this, func)); }
public void RunStep(IFlow flow) { _action(); }
public static void Subscribe <X>(this IFlow <X> @this) { @this.Subscribe(new EmptyFlowCallback <X>(), new Subscription()); }
public MapFlow(IFlow <TSource> upstream, Func <TSource, TTarget> func) { Upstream = upstream; Func = func; }
public static double Length(this IFlow flowObj) { return((flowObj.Geometry() as ICurve).ILength()); }
public void SetFlow(IFlow flow) { this._flow = (FlowImpl) flow; }
private async Task <bool> SubscribeQueueAsyncInternal(Queue queue, BufferBlock <Message> messageQueue = null, BufferBlock <FlowStateContext> flowEvtQueue = null, bool flowStartState = false) { FlowBindings.FlowBindingElement binding = null; if (messageQueue == null) { // Use default message block messageQueue = defaultAppMsgQueue; } bool newSubscription = flowBindings.AddBinding(queue, messageQueue, flowEvtQueue, out binding); if (newSubscription && binding != null) { try { // Configure flow properties var fp = new FlowProperties { AckMode = solaceOptions.ClientAck ? MessageAckMode.ClientAck : MessageAckMode.AutoAck, BindBlocking = false, // ensure we bind in non-blocking mode FlowStartState = flowStartState }; // Destination IEndpoint solQueue = null; if (queue.IsTemporary) { solQueue = session.CreateTemporaryQueue(queue.Name); } else { solQueue = ContextFactory.Instance.CreateQueue(queue.Name); } // Create the flow TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>(); IFlow flow = session.CreateFlow( fp, solQueue, null, async(sender, msgEv) => { await AcceptMessageEventAsync(msgEv, binding).ConfigureAwait(false); }, async(sender, flowEv) => { logger.LogDebug("FlowEvent: {0}, Info: {1}", flowEv.Event, flowEv.Info); var flowStateCtx = new FlowStateContext() { Info = flowEv.Info, ResponseCode = flowEv.ResponseCode }; switch (flowEv.Event) { case FlowEvent.UpNotice: flowStateCtx.State = FlowState.Up; tcs.TrySetResult(true); break; case FlowEvent.BindFailedError: flowStateCtx.State = FlowState.BindFailedError; logger.LogWarning(string.Format("Queue connection failure: {0}", flowEv.Event.ToString())); tcs.TrySetResult(false); break; case FlowEvent.DownError: flowStateCtx.State = FlowState.Down; break; case FlowEvent.FlowActive: flowStateCtx.State = FlowState.FlowActive; break; case FlowEvent.FlowInactive: flowStateCtx.State = FlowState.FlowInactive; break; default: break; } // Notify caller of the flow event await binding.DispatchFlowEventAsync(flowStateCtx).ConfigureAwait(false); }); binding.Flow = flow; return(await tcs.Task.ConfigureAwait(false)); } catch (Exception e) { binding.Flow = null; flowBindings.RemoveBinding(queue, out binding); throw new MessagingException(e.Message, e); } } if (!newSubscription && binding != null) { // If existing subscription then ignore and return success return(true); } return(false); }
private void SubscribeAndSendMessage(ISession session) { // Provision the queue string queueName = "Q/tutorial/topicToQueueMapping"; Console.WriteLine("Attempting to provision the queue '{0}'...", queueName); // Create the queue using (IQueue queue = ContextFactory.Instance.CreateQueue(queueName)) { // Set queue permissions to "consume" and access-type to "exclusive" EndpointProperties endpointProps = new EndpointProperties() { Permission = EndpointProperties.EndpointPermission.Consume, AccessType = EndpointProperties.EndpointAccessType.Exclusive, }; // Provision it, and do not fail if it already exists session.Provision(queue, endpointProps, ProvisionFlag.IgnoreErrorIfEndpointAlreadyExists & ProvisionFlag.WaitForConfirm, null); Console.WriteLine("Queue '{0}' has been created and provisioned.", queueName); // Add subscription to the topic mapped to the queue ITopic tutorialTopic = ContextFactory.Instance.CreateTopic("T/mapped/topic/sample"); session.Subscribe(queue, tutorialTopic, SubscribeFlag.WaitForConfirm, null); // Create the message using (IMessage message = ContextFactory.Instance.CreateMessage()) { // Message's destination is the queue topic and the message is persistent message.Destination = tutorialTopic; message.DeliveryMode = MessageDeliveryMode.Persistent; // Send it to the mapped topic a few times with different content for (int i = 0; i < TotalMessages; i++) { // Create the message content as a binary attachment message.BinaryAttachment = Encoding.ASCII.GetBytes( string.Format("Topic to Queue Mapping Tutorial! Message ID: {0}", i)); // Send the message to the queue on the Solace messaging router Console.WriteLine("Sending message ID {0} to topic '{1}' mapped to queue '{2}'...", i, tutorialTopic.Name, queueName); ReturnCode returnCode = session.Send(message); if (returnCode == ReturnCode.SOLCLIENT_OK) { Console.WriteLine("Done."); } else { Console.WriteLine("Sending failed, return code: {0}", returnCode); } } } Console.WriteLine("{0} messages sent. Processing replies.", TotalMessages); // Create and start flow to the newly provisioned queue // NOTICE HandleMessageEvent as the message event handler // and HandleFlowEvent as the flow event handler Flow = session.CreateFlow(new FlowProperties() { AckMode = MessageAckMode.ClientAck }, queue, null, HandleMessageEvent, HandleFlowEvent); Flow.Start(); // block the current thread until a confirmation received CountdownEvent.Wait(); } }
private void OnEnter(IFlow flow) => Debug.Log(Message.Value);
public void AddFlow(IFlow flow) { this.AddStreams(flow.Streams); this.AddOperations(flow.Operations); }
/// <summary> /// Creates a new job builder that will execute a flow. /// </summary> /// <param name="flow"></param> /// <returns></returns> public JobFlowBuilder Start(IFlow flow) { return new FlowJobBuilder(this).Start(flow); }
private void WriterNodes(IFlow flow, StreamWriter xmlwriter) { IEnumerator iter = flow.Logs.GetEnumerator(); while (iter.MoveNext()) { ILog eventLog = (ILog) iter.Current; xmlwriter.WriteLine("id->"+eventLog.Id); if (eventLog.EventType == EventType.FORK) { IEnumerator flowIter = eventLog.GetObjectReferences("Flow").GetEnumerator(); while (flowIter.MoveNext()) { ObjectReferenceImpl objectReference = (ObjectReferenceImpl) flowIter.Current; DbSession session = OpenSession(); objectReference.Resolve(session); session.Close(); IFlow subFlow = (IFlow) objectReference.GetObject(); xmlwriter.WriteLine("subflow"+subFlow+" ->"+subFlow); WriterNodes(subFlow ,xmlwriter); } } else if (eventLog.EventType == EventType.SUB_PROCESS_INSTANCE_START) { IObjectReference objectReference = (IObjectReference) eventLog.GetObjectReferences("ProcessInstance").GetEnumerator().Current; IProcessInstance subProcessInstance = (IProcessInstance) objectReference.GetObject(); WriterNodes(subProcessInstance.RootFlow ,xmlwriter); } } }
public override void Initialize(ref IFlow flow) { Flow = flow; Flow.Set(Id, (T)DefaultValue); }
public void Visit(IFlow flow) { Visit((dynamic)flow); }
public void RunStep(IFlow flow) { }
protected override void Calculate(IFlow flow) { Output.Value = !Input.Value; }
private void GetStateAndAttributes(IList state, IList attributeRows, String indentation, IFlow flow) { // add the flow to the state IEnumerator iter = flow.Children.GetEnumerator(); while (iter.MoveNext()) { state.Add(iter.Current); } // add the flow-name to the attributeRows System.Collections.IDictionary row = new System.Collections.Hashtable(); if (flow.IsRootFlow()) { row["name"] = indentation + "rootflow <b>[</b>" + flow.Name + "<b>]</b>"; } else { row["name"] = indentation + "subflow <b>[</b>" + flow.Name + "<b>]</b>"; } row["value"] = ""; attributeRows.Add(row); // add the flow-local attributes to the attributeRows iter = flow.AttributeInstances.GetEnumerator(); while (iter.MoveNext()) { IAttributeInstance attributeInstance = (IAttributeInstance)iter.Current; row = new Hashtable(); log.Debug("adding attribute instance value " + attributeInstance.GetValue()); row["name"] = indentation + " +- <b>[</b>" + attributeInstance.Attribute.Name + "<b>]</b>"; row["value"] = attributeInstance.GetValue(); attributeRows.Add(row); } // recursively descend to the children iter = flow.Children.GetEnumerator(); while (iter.MoveNext()) { GetStateAndAttributes(state, attributeRows, indentation + " | ", (IFlow)iter.Current); } IProcessInstance processInstance = flow.GetSubProcessInstance(); if (processInstance != null) { state.Add(processInstance.RootFlow); GetStateAndAttributes(state, attributeRows, indentation + " | ", processInstance.RootFlow); } }
private void AddAllActiveFlows(IFlow flow, IList flows) { if (flow.Children == null || flow.Children.Count == 0) { flows.Add(flow); } else { IEnumerator flowEnumer = flow.Children.GetEnumerator(); while (flowEnumer.MoveNext()) { AddAllActiveFlows((IFlow)flowEnumer.Current,flows); } } }
private void WriteFlowEnd(TextWriter logDetail, IFlow flow) { logDetail.Write("</table>" + "\r\n"); logDetail.Write("</td></tr></table>" + "\r\n"); }
/// <summary> /// Starts a job with this flow, but expect to transition from there to other flows or steps. /// </summary> /// <param name="flow"></param> /// <returns></returns> public JobFlowBuilder Start(IFlow flow) { return new JobFlowBuilder(this, flow); }
public NodeField(Instance instance, IObservableValue <string> name, IFlow flowInput, IFlow flowOutput, IOpacity opacity, ILaminarValueStore valueStore, IUserInterfaceManager userInterfaces) : base(name, flowInput, flowOutput, opacity) { _valueStore = valueStore; UserInterfaces = userInterfaces; UserInterfaces.Displays = instance.RegisteredDisplays; UserInterfaces.Editors = instance.RegisteredEditors; _factory = instance.Factory; _valueStore.ChildValueChanged += ValueStore_ChildValueChanged; _valueStore.ChangedAtKey += (o, e) => AnyValueChanged?.Invoke(this, e); Name.OnChange += _valueStore.SetValueName; }
public Job(IFlow context, String taskClassName) { if (_processDefinition == null) { throw new SystemException("couldn't create a Job with a null-value for processDefinition"); } if ((Object) taskClassName == null) { throw new SystemException("couldn't create a Job with a null-value for taskClassName"); } this._taskClassName = taskClassName; this._context = context; this._processDefinition = context.ProcessInstance.ProcessDefinition; }
/// <summary> /// Main function in the sample. /// </summary> /// <param name="args"></param> public override void SampleCall(string[] args) { #region Parse Arguments ArgParser cmdLineParser = new ArgParser(); if (!cmdLineParser.Parse(args)) { // Parse failed. PrintUsage(INVALID_ARGUMENTS_ERROR); return; } if (!SampleParseArgs(cmdLineParser)) { // Parse failed for sample's arguments. PrintUsage(INVALID_ARGUMENTS_ERROR); return; } #endregion #region Initialize properties from command line // Initialize the properties. ContextProperties contextProps = new ContextProperties(); SessionProperties sessionProps = SampleUtils.NewSessionPropertiesFromConfig(cmdLineParser.Config); #endregion // Define IContext and ISession. IContext context = null; ISession session = null; try { InitContext(cmdLineParser.LogLevel); Console.WriteLine("About to create the context ..."); context = ContextFactory.Instance.CreateContext(contextProps, null); Console.WriteLine("Context successfully created. "); Console.WriteLine("About to create the session ..."); session = context.CreateSession(sessionProps, SampleUtils.HandleMessageEvent, SampleUtils.HandleSessionEvent); Console.WriteLine("Session successfully created."); Console.WriteLine("About to connect the session ..."); if (session.Connect() == ReturnCode.SOLCLIENT_OK) { Console.WriteLine("Session successfully connected"); Console.WriteLine(GetRouterInfo(session)); } if (!session.IsCapable(CapabilityType.SUB_FLOW_GUARANTEED) || !(session.IsCapable(CapabilityType.TEMP_ENDPOINT))) { Console.WriteLine(string.Format("Capabilities '{0}' and '{1}' are required to run this sample", CapabilityType.SUB_FLOW_GUARANTEED, CapabilityType.TEMP_ENDPOINT)); return; } IQueue queue = null; if (cmdLineParser.Config.UseDurableEndpoint) { Console.WriteLine(string.Format("A non-temporary queue with name '{0}' must be provisioned and accessible on the appliance within the same user's Message VPN)", SampleUtils.SAMPLE_QUEUE)); queue = ContextFactory.Instance.CreateQueue(SampleUtils.SAMPLE_QUEUE); } else { Console.WriteLine("Creating a temporary queue"); queue = session.CreateTemporaryQueue(); } FlowProperties flowProps = new FlowProperties(); // The flow is created in a started state, so it is ready to receive messages. flowProps.FlowStartState = true; // ClientAck, which means that the received messages on the Flow // must be explicitly acked, otherwise they will be redelivered to the client // when the Flow reconnects. // ClientAck was chosen simply to illustrate ClientAck and that clients // can use AutoAck instead. flowProps.AckMode = MessageAckMode.ClientAck; flow = session.CreateFlow(flowProps, queue, null, // Demonstrates explicit client acknoweldgment of received messages. HandleMessageAndAck, SampleUtils.HandleFlowEvent); // Now publish a number of messages to the Queue. IMessage message = SampleUtils.CreateMessage(cmdLineParser.Config, session); message.Destination = queue; Console.WriteLine(string.Format("About to send {0} message(s) ...", cmdLineParser.Config.NumberOfMessagesToPublish)); // Send a number of messages to the Queue. for (int i = 0; i < cmdLineParser.Config.NumberOfMessagesToPublish; i++) { if (session.Send(message) == ReturnCode.SOLCLIENT_OK) { Console.Write("."); } Thread.Sleep(1000); // Wait for 0.5 seconds } Console.WriteLine(string.Format("\nDone\n Sleeping for {0} secs before exiting ", Timeout / 1000)); Thread.Sleep(Timeout); } catch (Exception ex) { PrintException(ex); } finally { if (flow != null) { flow.Dispose(); } if (session != null) { session.Dispose(); } if (context != null) { context.Dispose(); } // Must cleanup after. CleanupContext(); } }
/// <summary> /// Starts a job with this flow, but expect to transition from there to other flows or steps. /// </summary> /// <param name="flow"></param> /// <returns></returns> public JobFlowBuilder Start(IFlow flow) { return(new JobFlowBuilder(this, flow)); }
public void Visit(IFlow flow) { this.Visit(flow.StartBlock); }
/// <summary> /// Provides a single flow to execute as the job. /// </summary> /// <param name="flow"></param> /// <returns></returns> public FlowJobBuilder Flow(IFlow flow) { _flow = flow; return(this); }
/// <summary> /// Constructor for a FlowStep that sets the flow and of the step explicitly. /// </summary> /// <param name="flow"></param> public FlowStep(IFlow flow) : base(flow.GetName()) { }
private void WriteFlowStart(TextWriter logDetail, IFlow flow) { logDetail.Write("<table border=0 cellpadding=0 cellspacing=1 bgcolor=#000000 height=100%><tr><td bgcolor=#ffffff height=100% valign=top>" + "\r\n"); logDetail.Write("<table border=0 cellpadding=0 cellspacing=0>" + "\r\n"); logDetail.Write("<tr><th class=tableFlowCell width=100% colspan=2 nowrap> flow [<b>" + flow.Name + "</b>]</th></tr>" + "\r\n"); }
protected override void Calculate(IFlow flow) { Output.Value = Left.Value && Right.Value; }
private void WriteFlowEvent(TextWriter logDetail, ILog eventLog, IFlow flow) { logDetail.Write(" <tr>" + "\r\n"); logDetail.Write(" <td bgcolor=#ffffff>" + "\r\n"); logDetail.Write(" <table border=0 cellspacing=0 cellpadding=0 width=100%>" + "\r\n"); logDetail.Write(" <tr><th class=tableEventLogCell width=100% colspan=2 nowrap>" + eventLog.EventType + "</th></tr>" + "\r\n"); logDetail.Write(" <tr>" + "\r\n"); logDetail.Write(" <td> </td>" + "\r\n"); logDetail.Write(" <td width=100%>" + "\r\n"); this.details = new System.Collections.ArrayList(); AddDetail("Time", eventLog.Date.ToString()); IActor actor = eventLog.GetActor(); if (actor != null) { AddDetail("Actor", actor.Name); } if (eventLog.EventType == EventType.FORK) { logDetail.Write(" <table border=0 cellpadding=0 cellspacing=5>" + "\r\n"); logDetail.Write(" <tr>" + "\r\n"); IEnumerator iter = eventLog.GetObjectReferences("Flow").GetEnumerator(); while (iter.MoveNext()) { IObjectReference objectReference = (IObjectReference) iter.Current; IFlow subFlow = (IFlow) objectReference.GetObject(); subFlow = GetFlow(subFlow.Id); logDetail.Write(" <td valign=top height=100%>" + "\r\n"); WriteFlow(logDetail, subFlow); logDetail.Write(" </td>" + "\r\n"); } logDetail.Write(" </tr>" + "\r\n"); logDetail.Write(" </table>" + "\r\n"); } else if (eventLog.EventType == EventType.SUB_PROCESS_INSTANCE_START) { IObjectReference objectReference = (IObjectReference) eventLog.GetObjectReferences("ProcessInstance").GetEnumerator().Current; IProcessInstance subProcessInstance = (IProcessInstance) objectReference.GetObject(); IFlow subFlow = GetFlow(subProcessInstance.RootFlow.Id); WriteFlow(logDetail, subFlow); } else { // if it is no fork or subprocess, log the details IEnumerator iter = eventLog.Details.GetEnumerator(); while (iter.MoveNext()) { AddDetail((ILogDetail) iter.Current); } WriteDetails(logDetail); } logDetail.Write(" </td>" + "\r\n"); logDetail.Write(" </tr>" + "\r\n"); logDetail.Write(" <tr><td> </td></tr>" + "\r\n"); logDetail.Write(" </table>" + "\r\n"); logDetail.Write(" </td>" + "\r\n"); logDetail.Write(" </tr>" + "\r\n"); }
/// <summary> /// Custom constructor using a parent JobFlowBuilder and a flow. /// </summary> /// <param name="parent"></param> /// <param name="flow"></param> public JobFlowBuilder(FlowJobBuilder parent, IFlow flow) : base(parent.GetName()) { _parent = parent; Start(flow); }