コード例 #1
0
        protected internal override object Execute(ICommandContext commandContext, IExecutionEntity execution)
        {
            if (messageName is null)
            {
                throw new ActivitiIllegalArgumentException("messageName cannot be null");
            }

            IEventSubscriptionEntityManager  eventSubscriptionEntityManager = commandContext.EventSubscriptionEntityManager;
            IList <IEventSubscriptionEntity> eventSubscriptions             = eventSubscriptionEntityManager.FindEventSubscriptionsByNameAndExecution(MessageEventHandler.EVENT_HANDLER_TYPE, messageName, executionId);

            if (eventSubscriptions.Count == 0)
            {
                throw new ActivitiException("Execution with id '" + executionId + "' does not have a subscription to a message event with name '" + messageName + "'");
            }

            // there can be only one:
            IEventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions[0];

            eventSubscriptionEntityManager.EventReceived(eventSubscriptionEntity, payload, async);

            return(null);
        }