www-jrtorres042-github-enterprise-org
/
git_microsoft-powershell_achived-credential_shield.io-tracker_covid-19_live-bpm-platform-diff-1
Public template
forked from camunda/camunda-bpm-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(engine): adds asynchronous message correlation API
* adds RuntimeService method for asynchronous message correlation to multiple process instances * adds asynchronous message correlation builder * enables `executionsOnly` message correlation internally (no public API) * adds message correlation batch resources (job handler, batch type, permissions, JSON converter) * enables the batch jobs to be scheduled exclusively by the job executor by adding a process instance id to the jobs if they correlate to exactly one process instance * refactors runWithoutAuthorization to accept a command as well related to CAM-13863, CAM-13819
- Loading branch information
Showing
46 changed files
with
1,530 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
engine/src/main/java/org/camunda/bpm/engine/impl/MessageCorrelationAsyncBuilderImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. Camunda licenses this file to you under the Apache License, | ||
* Version 2.0; you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.camunda.bpm.engine.impl; | ||
|
||
import static org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.camunda.bpm.engine.batch.Batch; | ||
import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery; | ||
import org.camunda.bpm.engine.impl.cmd.batch.CorrelateAllMessageBatchCmd; | ||
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; | ||
import org.camunda.bpm.engine.runtime.MessageCorrelationAsyncBuilder; | ||
import org.camunda.bpm.engine.runtime.ProcessInstanceQuery; | ||
import org.camunda.bpm.engine.variable.impl.VariableMapImpl; | ||
|
||
public class MessageCorrelationAsyncBuilderImpl implements MessageCorrelationAsyncBuilder { | ||
|
||
protected CommandExecutor commandExecutor; | ||
|
||
protected String messageName; | ||
protected Map<String, Object> payloadProcessInstanceVariables; | ||
|
||
protected List<String> processInstanceIds; | ||
protected ProcessInstanceQuery processInstanceQuery; | ||
protected HistoricProcessInstanceQuery historicProcessInstanceQuery; | ||
|
||
public MessageCorrelationAsyncBuilderImpl(CommandExecutor commandExecutor, String messageName) { | ||
this(messageName); | ||
ensureNotNull("commandExecutor", commandExecutor); | ||
this.commandExecutor = commandExecutor; | ||
} | ||
|
||
private MessageCorrelationAsyncBuilderImpl(String messageName) { | ||
this.messageName = messageName; | ||
} | ||
|
||
public MessageCorrelationAsyncBuilder processInstanceIds(List<String> ids) { | ||
ensureNotNull("processInstanceIds", ids); | ||
this.processInstanceIds = ids; | ||
return this; | ||
} | ||
|
||
@Override | ||
public MessageCorrelationAsyncBuilder processInstanceQuery(ProcessInstanceQuery processInstanceQuery) { | ||
ensureNotNull("processInstanceQuery", processInstanceQuery); | ||
this.processInstanceQuery = processInstanceQuery; | ||
return this; | ||
} | ||
|
||
@Override | ||
public MessageCorrelationAsyncBuilder historicProcessInstanceQuery(HistoricProcessInstanceQuery historicProcessInstanceQuery) { | ||
ensureNotNull("historicProcessInstanceQuery", historicProcessInstanceQuery); | ||
this.historicProcessInstanceQuery = historicProcessInstanceQuery; | ||
return this; | ||
} | ||
|
||
public MessageCorrelationAsyncBuilder setVariable(String variableName, Object variableValue) { | ||
ensureNotNull("variableName", variableName); | ||
ensurePayloadProcessInstanceVariablesInitialized(); | ||
payloadProcessInstanceVariables.put(variableName, variableValue); | ||
return this; | ||
} | ||
|
||
public MessageCorrelationAsyncBuilder setVariables(Map<String, Object> variables) { | ||
if (variables != null) { | ||
ensurePayloadProcessInstanceVariablesInitialized(); | ||
payloadProcessInstanceVariables.putAll(variables); | ||
} | ||
return this; | ||
} | ||
|
||
protected void ensurePayloadProcessInstanceVariablesInitialized() { | ||
if (payloadProcessInstanceVariables == null) { | ||
payloadProcessInstanceVariables = new VariableMapImpl(); | ||
} | ||
} | ||
|
||
@Override | ||
public Batch correlateAllAsync() { | ||
return commandExecutor.execute(new CorrelateAllMessageBatchCmd(this)); | ||
} | ||
|
||
// getters ////////////////////////////////// | ||
|
||
public CommandExecutor getCommandExecutor() { | ||
return commandExecutor; | ||
} | ||
|
||
public String getMessageName() { | ||
return messageName; | ||
} | ||
|
||
public List<String> getProcessInstanceIds() { | ||
return processInstanceIds; | ||
} | ||
|
||
public ProcessInstanceQuery getProcessInstanceQuery() { | ||
return processInstanceQuery; | ||
} | ||
|
||
public HistoricProcessInstanceQuery getHistoricProcessInstanceQuery() { | ||
return historicProcessInstanceQuery; | ||
} | ||
|
||
public Map<String, Object> getPayloadProcessInstanceVariables() { | ||
return payloadProcessInstanceVariables; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.