Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUESTION: Process not in COMPLETED state? #118

Closed
eriknyk opened this issue Jun 2, 2023 · 4 comments
Closed

QUESTION: Process not in COMPLETED state? #118

eriknyk opened this issue Jun 2, 2023 · 4 comments
Labels
question Further information is requested wip work in progress

Comments

@eriknyk
Copy link

eriknyk commented Jun 2, 2023

QUESTION: Why if we create & run the instance CreateAndRunInstance simple_task.bpmn
technically the process finished but if after CreateAndRunInstance() finishes then I dump the instance state it is in state ACTIVE when it looks like it should to has COMPLETED state.

image
        // create a new named engine
	bpmnEngine := bpmn_engine.New("a name")
	// basic example loading a BPMN from file,
	//process, err := bpmnEngine.LoadFromFile("simple_task.bpmn")
	process, err := bpmnEngine.LoadFromFile("simple_user_task.bpmn")

	if err != nil {
		panic("file \"simple_task.bpmn\" can't be read.")
	}
	// register a handler for a service task by defined task type
	bpmnEngine.NewTaskHandler().Id("hello-world").Handler(printContextHandler)

	bpmnEngine.NewTaskHandler().Assignee("assignee").Handler(userTaskHandler())

	// setup some variables
	variables := map[string]interface{}{}
	variables["foo"] = "bar"
	// and execute the process
	instance, err := bpmnEngine.CreateAndRunInstance(process.ProcessKey, variables)
	if err != nil {
		return
	}

	println("InstanceKey: " + strconv.FormatInt(instance.GetInstanceKey(), 10))
	println("State: " + string(instance.GetState()))

Output:

< Hello World >
ElementId                = hello-world
BpmnProcessId            = Simple_Task_Process
ProcessDefinitionKey     = 1664696323368030208
ProcessDefinitionVersion = 1
CreatedAt                = 2023-06-02 13:11:46.710748 -0500 -05 m=+0.003794422
Variable 'foo'           = bar
InstanceKey: 1664696323368030209
State: "ACTIVE"

@eriknyk eriknyk changed the title QUESTION: Why if we create & run the instance simple_task.bpmn technically the process finished but QUESTION: Process not in COMPLETED state? Jun 2, 2023
@jinjaghost
Copy link

jinjaghost commented Aug 22, 2023

Hi @eriknyk, in order to help you, can you please provide the userTaskHandler handler function ?

@eriknyk
Copy link
Author

eriknyk commented Aug 22, 2023

I will do, thanks @jinjaghost

@nitram509
Copy link
Owner

Hi @eriknyk
Indeed, as @jinjaghost mentioned, is important that the task handler sends the "complete" signal.
Else, a task is considered un-finished == still active.

Regards
Martin

@nitram509 nitram509 added question Further information is requested wip work in progress labels Aug 23, 2023
@nitram509
Copy link
Owner

Seems answered. If not, feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wip work in progress
Projects
None yet
Development

No branches or pull requests

3 participants