public function receiveMessage($message, WorkflowEngine $workflowEngine)
    {
        if ($message instanceof WorkflowMessage) {
            if (MessageNameUtils::isProcessingCommand($message->messageName())) {
                $this->perform($workflowEngine, $message);
                return;
            }

            $this->assertTaskEntryExists($message->processTaskListPosition());

            $this->recordThat(TaskEntryMarkedAsDone::at($message->processTaskListPosition()));

            $this->perform($workflowEngine, $message);
            return;
        }

        if ($message instanceof LogMessage) {
            $this->assertTaskEntryExists($message->processTaskListPosition());

            $this->recordThat(LogMessageReceived::record($message));

            if ($message->isError()) {
                $this->recordThat(TaskEntryMarkedAsFailed::at($message->processTaskListPosition()));
            } elseif ($this->isSubProcess() && $this->syncLogMessages) {
                //We only sync non error messages, because errors are always synced and then they would be received twice
                $messageForParent = $message->reconnectToProcessTask($this->parentTaskListPosition);
                $workflowEngine->dispatch($messageForParent);
            }
        }
    }
public function receiveMessage($message, WorkflowEngine $workflowEngine)
    {
        if ($message instanceof WorkflowMessage) {
            if (MessageNameUtils::isProcessingCommand($message->messageName())) {
                $this->perform($workflowEngine, $message);
                return;
            }

            $this->assertTaskEntryExists($message->processTaskListPosition());

            $this->recordThat(TaskEntryMarkedAsDone::at($message->processTaskListPosition()));

            $this->perform($workflowEngine, $message);
            return;
        }

        if ($message instanceof LogMessage) {
            $this->assertTaskEntryExists($message->processTaskListPosition());

            $this->recordThat(LogMessageReceived::record($message));

            if ($message->isError()) {
                $this->recordThat(TaskEntryMarkedAsFailed::at($message->processTaskListPosition()));
            } elseif ($this->isSubProcess() && $this->syncLogMessages) {
                //We only sync non error messages, because errors are always synced and then they would be received twice
                $messageForParent = $message->reconnectToProcessTask($this->parentTaskListPosition);
                $workflowEngine->dispatch($messageForParent);
            }
        }
    }
public function receiveMessage ( $ message , WorkflowEngine $ workflowEngine ) { if ( $ message instanceof WorkflowMessage ) { if ( MessageNameUtils :: isProcessingCommand ( $ message -> messageName ( ) ) ) { $ this -> perform ( $ workflowEngine , $ message ) ; return ; } $ this -> assertTaskEntryExists ( $ message -> processTaskListPosition ( ) ) ; $ this -> recordThat ( TaskEntryMarkedAsDone :: at ( $ message -> processTaskListPosition ( ) ) ) ; $ this -> perform ( $ workflowEngine , $ message ) ; return ; } if ( $ message instanceof LogMessage ) { $ this -> assertTaskEntryExists ( $ message -> processTaskListPosition ( ) ) ; $ this -> recordThat ( LogMessageReceived :: record ( $ message ) ) ; if ( $ message -> isError ( ) ) { $ this -> recordThat ( TaskEntryMarkedAsFailed :: at ( $ message -> processTaskListPosition ( ) ) ) ; } elseif ( $ this -> isSubProcess ( ) && $ this -> syncLogMessages ) { //We only sync non error messages, because errors are always synced and then they would be received twice $ messageForParent = $ message -> reconnectToProcessTask ( $ this -> parentTaskListPosition ) ; $ workflowEngine -> dispatch ( $ messageForParent ) ; } } }
A Process can start or continue with the next step after it has received a message

@param WorkflowMessage|LogMessage $message
@param WorkflowEngine $workflowEngine
@throws \RuntimeException
@return void
A Process can start or continue with the next step after it has received a message