question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to correctly resume state?

See original GitHub issue

Hello, I created small sample diagram and script, that must resume execution of diagram if it unexpectedly stops. But in fact it executes only last block and stops whole script. Please help, what I’m doing wrong?

2017-03-20 11 34 51

Normal execution, without interrupt ( with debug )

~ node index.js
START Test process
START Start
START Task A
START Task B
Waiting Task B for 5 seconds...
START Parallel 2
Resume Task B!
START Task C
Script completed

Execution with interrupt on Task B ( with debug ) :

~ node index.js
START Test process
START Start
START Task A
START Task B
Waiting Task B for 5 seconds...
START Parallel 2
^C

~ node index.js
Resuming saved state
START Task B
Waiting Task B for 5 seconds...
Resume Task B!
START Parallel 2

Code: index.js and Services.json

Diagram: diagram_1.bpmn

engine.getState() output when I interrupted execution by ^C: state.json

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
paed01commented, Mar 28, 2017

I have tried to make sure there is a state to save when listening on start, e.g:

listener.on('start', () => {})`.

@NeonXP: Can you update the engine with npm i bpmn-engine@rc and try again?

1reaction
paed01commented, Apr 6, 2017

@christopherRiddersater I would, imho, consider a message broker, e.g. RabbitMQ. When the listener emits wait or start (or ends) a message is published with the state. It is non-interrupting and the state is saved even if the instance is abruptly terminated.

Regarding states, what I’m trying to argue is that the diagram designer (or devops) knows best when a recoverable state is in place. To facilitate this the bpmn-engine could expose the activity properties (defined in the modeler), as such:

const amqp = require('exp-amqp-connection');
const connection = amqp({
  exchange: 'bpmn-engine',
  url: 'amqp://localhost'
});

//...

listener.on('start', (activity) => {
  // camunda modeler - select activity - tab Extensions + Add Property
  if (activity.properties.recoverableState) {
    return connection.publish('state.recoverable', engine.getState());
  }
  return connection.publish('state', engine.getState());
});

engine.once('end', () => {
  connection.publish('bpmn-engine', 'end', engine.getState());
});

Would that help? (#20?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Create a Resume for a State and Local Government Job
For example, if you were given a task to lead a project, mention how many people worked under you. Also, you can state...
Read more >
How to Make a Resume in 2023 | Beginner's Guide
Everything you need to know about how to write a resume. Step-by-step guide, covering 21+ real-life examples, resume templates that you can use,...
Read more >
How To Make a Comprehensive Resume (With Examples)
Be brief. Employers have mere seconds to review your resume, so you should keep your descriptions as concise and relevant as possible. Try ......
Read more >
How to Write a Resume in 2023: A Step-by-Step Guide
Company name and location – Include the full name of the company you worked for followed by the city and state of its...
Read more >
How to Make a Resume: Step-by-Step Writing Guide for 2023
Photo/Headshot: In the United States, resume images and profile photos are usually ... Not sure about the proper resume education format?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found