@Test public void receiveShouldDoNothingWhenIntegrationContextsIsNull() { given(integrationContextService.findById(ENTITY_ID)) .willReturn(null); given(executionQuery.list()).willReturn(Collections.singletonList(mock(Execution.class))); Map<String, Object> variables = Collections.singletonMap("var1", "v"); IntegrationContextImpl integrationContext = buildIntegrationContext(variables); handler.receive(new IntegrationResultImpl(new IntegrationRequestImpl(), integrationContext)); verify(integrationContextService, never()).deleteIntegrationContext(any()); }
@StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) public void receive(IntegrationResult integrationResult) { IntegrationContext integrationContext = integrationResult.getIntegrationContext(); IntegrationContextEntity integrationContextEntity = integrationContextService.findById(integrationContext.getId()); if (integrationContextEntity != null) { integrationContextService.deleteIntegrationContext(integrationContextEntity); List<Execution> executions = runtimeService.createExecutionQuery().executionId(integrationContextEntity.getExecutionId()).list(); if (executions.size() > 0) { runtimeService.trigger(integrationContextEntity.getExecutionId(), outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(integrationContext.getProcessDefinitionId(), executions.get(0).getActivityId()), integrationContext.getOutBoundVariables())); } else { String message = "No task is in this RB is waiting for integration result with execution id `" + integrationContextEntity.getExecutionId() + ", flow node id `" + integrationContext.getClientId() + "`. The integration result for the integration context `" + integrationContext.getId() + "` will be ignored."; LOGGER.debug(message); } sendAuditMessage(integrationResult); } }
ServiceTaskIntegrationResultEventHandler { @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) public void receive(IntegrationResult integrationResult) { IntegrationContext integrationContext = integrationResult.getIntegrationContext(); IntegrationContextEntity integrationContextEntity = integrationContextService.findById(integrationContext.getId()); if (integrationContextEntity != null) { integrationContextService.deleteIntegrationContext(integrationContextEntity); List<Execution> executions = runtimeService.createExecutionQuery().executionId(integrationContextEntity.getExecutionId()).list(); if (executions.size() > 0) { runtimeService.trigger(integrationContextEntity.getExecutionId(), outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(integrationContext.getProcessDefinitionId(), executions.get(0).getActivityId()), integrationContext.getOutBoundVariables())); } else { String message = "No task is in this RB is waiting for integration result with execution id `" + integrationContextEntity.getExecutionId() + ", flow node id `" + integrationContext.getClientId() + "`. The integration result for the integration context `" + integrationContext.getId() + "` will be ignored."; LOGGER.debug(message); } sendAuditMessage(integrationResult); } } }
ServiceTaskIntegrationResultEventHandler { @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) public void receive(IntegrationResult integrationResult) { IntegrationContext integrationContext = integrationResult.getIntegrationContext(); IntegrationContextEntity integrationContextEntity = integrationContextService.findById(integrationContext.getId()); if (integrationContextEntity != null) { integrationContextService.deleteIntegrationContext(integrationContextEntity); List<Execution> executions = runtimeService.createExecutionQuery().executionId(integrationContextEntity.getExecutionId()).list(); if (executions.size() > 0) { runtimeService.trigger(integrationContextEntity.getExecutionId(), outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(integrationContext.getProcessDefinitionId(), executions.get(0).getActivityId()), integrationContext.getOutBoundVariables())); } else { String message = "No task is in this RB is waiting for integration result with execution id `" + integrationContextEntity.getExecutionId() + ", flow node id `" + integrationContext.getClientId() + "`. The integration result for the integration context `" + integrationContext.getId() + "` will be ignored."; LOGGER.debug(message); } sendAuditMessage(integrationResult); } } ServiceTaskIntegrationResultEventHandler(RuntimeService runtimeService,
                                                    IntegrationContextService integrationContextService,
                                                    MessageChannel auditProducer,
                                                    RuntimeBundleProperties runtimeBundleProperties,
                                                    RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                                    VariablesMappingProvider outboundVariablesProvider); }
ServiceTaskIntegrationResultEventHandler { @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) public void receive(IntegrationResult integrationResult) { IntegrationContext integrationContext = integrationResult.getIntegrationContext(); IntegrationContextEntity integrationContextEntity = integrationContextService.findById(integrationContext.getId()); if (integrationContextEntity != null) { integrationContextService.deleteIntegrationContext(integrationContextEntity); List<Execution> executions = runtimeService.createExecutionQuery().executionId(integrationContextEntity.getExecutionId()).list(); if (executions.size() > 0) { runtimeService.trigger(integrationContextEntity.getExecutionId(), outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(integrationContext.getProcessDefinitionId(), executions.get(0).getActivityId()), integrationContext.getOutBoundVariables())); } else { String message = "No task is in this RB is waiting for integration result with execution id `" + integrationContextEntity.getExecutionId() + ", flow node id `" + integrationContext.getClientId() + "`. The integration result for the integration context `" + integrationContext.getId() + "` will be ignored."; LOGGER.debug(message); } sendAuditMessage(integrationResult); } } ServiceTaskIntegrationResultEventHandler(RuntimeService runtimeService,
                                                    IntegrationContextService integrationContextService,
                                                    MessageChannel auditProducer,
                                                    RuntimeBundleProperties runtimeBundleProperties,
                                                    RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                                    VariablesMappingProvider outboundVariablesProvider); @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) void receive(IntegrationResult integrationResult); }
ServiceTaskIntegrationResultEventHandler { @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) public void receive(IntegrationResult integrationResult) { IntegrationContext integrationContext = integrationResult.getIntegrationContext(); IntegrationContextEntity integrationContextEntity = integrationContextService.findById(integrationContext.getId()); if (integrationContextEntity != null) { integrationContextService.deleteIntegrationContext(integrationContextEntity); List<Execution> executions = runtimeService.createExecutionQuery().executionId(integrationContextEntity.getExecutionId()).list(); if (executions.size() > 0) { runtimeService.trigger(integrationContextEntity.getExecutionId(), outboundVariablesProvider.calculateOutPutVariables(buildMappingExecutionContext(integrationContext.getProcessDefinitionId(), executions.get(0).getActivityId()), integrationContext.getOutBoundVariables())); } else { String message = "No task is in this RB is waiting for integration result with execution id `" + integrationContextEntity.getExecutionId() + ", flow node id `" + integrationContext.getClientId() + "`. The integration result for the integration context `" + integrationContext.getId() + "` will be ignored."; LOGGER.debug(message); } sendAuditMessage(integrationResult); } } ServiceTaskIntegrationResultEventHandler(RuntimeService runtimeService,
                                                    IntegrationContextService integrationContextService,
                                                    MessageChannel auditProducer,
                                                    RuntimeBundleProperties runtimeBundleProperties,
                                                    RuntimeBundleInfoAppender runtimeBundleInfoAppender,
                                                    VariablesMappingProvider outboundVariablesProvider); @StreamListener(ProcessEngineIntegrationChannels.INTEGRATION_RESULTS_CONSUMER) void receive(IntegrationResult integrationResult);  }