-
Notifications
You must be signed in to change notification settings - Fork 39
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
Support loading workflow definitions from database #531
Conversation
28fc406
to
ffbe63b
Compare
nflow-engine/src/main/java/io/nflow/engine/service/WorkflowDefinitionService.java
Outdated
Show resolved
Hide resolved
nflow-engine/src/main/java/io/nflow/engine/service/WorkflowDefinitionService.java
Outdated
Show resolved
Hide resolved
d99b6b7
to
7d9a191
Compare
nflow-engine/src/main/java/io/nflow/engine/service/WorkflowDefinitionService.java
Outdated
Show resolved
Hide resolved
konffin default arvo pitäis olla default propsuissa ja sitten se voisikin olla required |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update new config to readme
nflow-engine/src/test/java/io/nflow/engine/service/WorkflowDefinitionServiceTest.java
Outdated
Show resolved
Hide resolved
9d1d14a
to
4bdfde2
Compare
…n.load=true is set
Co-authored-by: Edvard Fonsell <edvard.fonsell@nitor.com>
…ify instead to keep spotbugs happy
…ing the signature of existing
…ride the db profile
…ses can insert/query them while another server with code runs them
b5918e6
to
01fb149
Compare
… stored workflow definition loaded from other executors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks otherwise good, the comments require no action, but the implementation seems to miss handling for this kind of scenarios:
- Two executors 1 & 2 in the same group, both have dispatcher running.
- Executor 1 has implementation for WorkflowDefinition1
- Executor 2 has implementation for WorkflowDefinition2
- WorkflowDefinition1 instance is submitted - prevent it from being executed on executor 2
CHANGELOG.md
Outdated
@@ -14,6 +15,13 @@ | |||
**Details** | |||
|
|||
- `nflow-engine` | |||
- Add support to manage (create, update and read, but not execute) workflow instances without having the workflow implementation classes in the classpath. | |||
- If a workflow definition is not found from the classpath, it is loaded from the database and stored in memory. | |||
- Workflow definitions that are loaded from the database are refreshed at most at configured interval (`nflow.definition.loadMissingFromDatabaseSeconds`, default 60). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically, someone might depend on the fact that instances cannot be managed for historical workflow definitions. So need to consider which kind of version needs to be released next, or could start with -1
as default and change the default to 60
in next major version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find that a bit too theoretical to worry about breaking it. Nevertheless, I added few lines on readme about that and instructions on how to disable the new functionality.
|
||
private static WorkflowState getInitialState(StoredWorkflowDefinition stored) { | ||
return stored.states.stream() | ||
.filter(state -> start.name().equals((state.type))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It a shame that we don't currently persist the default start state (=initial state). But can't be helped here, perhaps add another issue about that.
The maximum rate can be controller with
nflow.definition.loadMissingFromDatabaseSeconds
- default rate is once every 60 seconds. But the definitions are only loaded from database if needed, not constantly in the background.