Example #1
0
        public virtual CorrelationHandlerResult correlateMessage(CommandContext commandContext, string messageName, CorrelationSet correlationSet)
        {
            // first try to correlate to execution
            IList <CorrelationHandlerResult> correlations = correlateMessageToExecutions(commandContext, messageName, correlationSet);

            if (correlations.Count > 1)
            {
                throw LOG.exceptionCorrelateMessageToSingleExecution(messageName, correlations.Count, correlationSet);
            }
            else if (correlations.Count == 1)
            {
                return(correlations[0]);
            }

            // then try to correlate to process definition
            correlations = correlateStartMessages(commandContext, messageName, correlationSet);

            if (correlations.Count > 1)
            {
                throw LOG.exceptionCorrelateMessageToSingleProcessDefinition(messageName, correlations.Count, correlationSet);
            }
            else if (correlations.Count == 1)
            {
                return(correlations[0]);
            }
            else
            {
                return(null);
            }
        }