Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment @Test public void testSingleIntermediateMessageEvent()
        public virtual void testSingleIntermediateMessageEvent()
        {
            ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");

            IList <string> activeActivityIds = runtimeService.getActiveActivityIds(pi.Id);

            assertNotNull(activeActivityIds);
            assertEquals(1, activeActivityIds.Count);
            assertTrue(activeActivityIds.Contains("messageCatch"));

            string    messageName = "newInvoiceMessage";
            Execution execution   = runtimeService.createExecutionQuery().messageEventSubscriptionName(messageName).singleResult();

            assertNotNull(execution);

            runtimeService.messageEventReceived(messageName, execution.Id);

            Task task = taskService.createTaskQuery().singleResult();

            assertNotNull(task);
            taskService.complete(task.Id);
        }
Example #2
0
        public virtual void triggerEvent(ExecutionTriggerDto triggerDto)
        {
            RuntimeService runtimeService = engine.RuntimeService;


            try
            {
                VariableMap variables = VariableValueDto.toMap(triggerDto.Variables, engine, objectMapper);
                runtimeService.messageEventReceived(messageName, executionId, variables);
            }
            catch (AuthorizationException e)
            {
                throw e;
            }
            catch (ProcessEngineException e)
            {
                throw new RestException(Status.INTERNAL_SERVER_ERROR, e, string.Format("Cannot trigger message {0} for execution {1}: {2}", messageName, executionId, e.Message));
            }
            catch (RestException e)
            {
                string errorMessage = string.Format("Cannot trigger message {0} for execution {1}: {2}", messageName, executionId, e.Message);
                throw new InvalidRequestException(e.Status, e, errorMessage);
            }
        }