bp-message-log-improvement (#1850)

* updated logging for messages from the background processor to hopefully make it easier to debug

* minor tweaks to message log

---------

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-07-02 10:29:21 -04:00 committed by GitHub
parent 77408073aa
commit 25947a71ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -125,10 +125,10 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel):
except Exception as e:
# the failure of a payload evaluation may not mean that matches for these
# message instances can't happen with other messages. So don't error up.
# fixme: Perhaps log some sort of error.
current_app.logger.warning(
"Error evaluating correlation key when comparing send and receive messages."
+ f"Expression {correlation_key.retrieval_expression} failed with the error "
"Error evaluating correlation key when comparing send and receive messages. "
+ f"Mesage name: '{self.name}'. Receive mesage id: '{self.id}'. "
+ f"Expression {correlation_key.retrieval_expression} failed with the error: "
+ str(e)
)
return False

View File

@ -1,5 +1,6 @@
from typing import Any
from flask import current_app
from flask import g
from SpiffWorkflow.bpmn import BpmnEvent # type: ignore
from SpiffWorkflow.bpmn.specs.event_definitions.message import CorrelationProperty # type: ignore
@ -138,6 +139,10 @@ class MessageService:
message_instances_send = MessageInstanceModel.query.filter_by(message_type="send", status="ready").all()
for message_instance_send in message_instances_send:
current_app.logger.info(
f"Processor waiting send messages: Processing message id {message_instance_send.id}. "
f"Name: '{message_instance_send.name}'"
)
cls.correlate_send_message(message_instance_send, execution_mode=execution_mode)
@classmethod