Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function runScripTask(ScriptTaskInterface $scriptTask, TokenInterface $to
'bpmn' => $version,
'action' => self::ACTION_RUN_SCRIPT,
'params' => [
'request_id' => $token->process_request_id,
'instance_id' => $instance->uuid,
'token_id' => $token->uuid,
'element_id' => $token->element_id,
'data' => [],
Expand All @@ -252,7 +252,7 @@ public function runScripTask(ScriptTaskInterface $scriptTask, TokenInterface $to
'session' => [
'user_id' => $userId,
],
]);
], 'scripts');
}

/**
Expand Down Expand Up @@ -631,13 +631,14 @@ private function getAdminUser(): ? User
* Send payload
*
* @param array $action
* @param string $subject
* @return void
*/
private function dispatchAction(array $action): void
private function dispatchAction(array $action, $subject = 'requests'): void
{
// add environment variables to session
$environmentVariables = $this->getEnvironmentVariables();
$action['session']['env'] = $environmentVariables;
$subject = 'requests';
$thread = $action['collaboration_id'] ?? 0;
MessageBrokerService::sendMessage($subject, $thread, $action);
}
Expand Down
9 changes: 7 additions & 2 deletions ProcessMaker/Nayra/MessageBrokers/ServiceRabbitMq.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ public function sendMessage(string $subject, string $collaborationId, mixed $bod
}

// Prepare the message to send
$message = new AMQPMessage(json_encode(['data' => $body, 'collaboration_id' => $collaborationId]));
if ($subject === 'scripts') {
$payload = json_encode($body);
} else {
$payload = json_encode(['data' => $body, 'collaboration_id' => $collaborationId]);
}
$message = new AMQPMessage($payload);

// Publish the message
$this->channel->basic_publish($message, '', self::QUEUE_NAME_PUBLISH);
$this->channel->basic_publish($message, '', $subject);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions ProcessMaker/Repositories/TokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ public function persistActivityException(ActivityInterface $activity, TokenInter
*/
public function persistActivityCompleted(ActivityInterface $activity, TokenInterface $token)
{
if ($token->getInstance()->status === 'ERROR') {
$token->getInstance()->status = 'ACTIVE';
}
$process = $token->getInstance()->getProcess();
if ($process->isNonPersistent()) {
return;
Expand Down
2 changes: 0 additions & 2 deletions ProcessMaker/RetryProcessRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public function retry(): void

$this->unlockProcessRequest();

$this->reactivateRequest();

$this->getRetriableTasks()->each(function (ProcessRequestToken $token) {
// Load the token instance
$token = $token->loadTokenInstance();
Expand Down