Needed an additional check for empty correlation keys - which on a RECEIVE message, should always match anything.

When finding messages to match a send, assure they are RECIEVE messages.

Fix some of the json output for messages sent to the front end
This commit is contained in:
Dan 2023-02-27 14:01:21 -05:00
parent 7c74e216a2
commit 4ca6e3f276
2 changed files with 8 additions and 2 deletions

View File

@ -100,6 +100,11 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel):
# We know we have a match, and we can just return if we don't have to figure out the key
return True
if self.correlation_keys == {}:
# Then there is nothing more to match on -- we accept any message with the given name.
return True
# Loop over the receives' correlation keys - if any of the keys fully match, then we match.
for expected_values in self.correlation_keys.values():
if self.payload_matches_expected_values(

View File

@ -1,6 +1,6 @@
"""Message_service."""
from spiffworkflow_backend.models.db import db
from spiffworkflow_backend.models.message_instance import MessageInstanceModel
from spiffworkflow_backend.models.message_instance import MessageInstanceModel, MessageTypes
from spiffworkflow_backend.models.message_instance import MessageStatuses
from spiffworkflow_backend.models.message_triggerable_process_model import (
MessageTriggerableProcessModel,
@ -42,7 +42,8 @@ class MessageService:
# Find available messages that might match
available_receive_messages = MessageInstanceModel.query.filter_by(
name=message_instance_send.name, status=MessageStatuses.ready.value
name=message_instance_send.name, status=MessageStatuses.ready.value,
message_type=MessageTypes.receive.value
).all()
message_instance_receive: MessageInstanceModel | None = None
try: