Search in sources :

Example 1 with EndFlowEvent

use of org.apache.synapse.aspects.flow.statistics.log.templates.EndFlowEvent in project wso2-synapse by wso2.

the class CloseEventCollector method closeFlowForcefully.

/**
 * Enqueue statistics event to the event queue. This method invokes when fault sequence finished handling the fault
 * occurred in the message flow.
 *
 * @param messageContext synapse message context.
 */
public static void closeFlowForcefully(MessageContext messageContext, boolean error) {
    if (shouldReportStatistic(messageContext)) {
        BasicStatisticDataUnit dataUnit = new BasicStatisticDataUnit();
        dataUnit.setTime(System.currentTimeMillis());
        dataUnit.setSynapseEnvironment(messageContext.getEnvironment());
        dataUnit.setStatisticId(StatisticDataCollectionHelper.getStatisticTraceId(messageContext));
        dataUnit.setCurrentIndex(StatisticDataCollectionHelper.getParentFlowPosition(messageContext, null));
        EndFlowEvent endFlowEvent = new EndFlowEvent(dataUnit);
        if (!error) {
            addEventAndDecrementCount(messageContext, endFlowEvent);
        } else {
            addEventAndCloseFlow(messageContext, endFlowEvent);
        }
        if (isOpenTracingEnabled()) {
            OpenTracingManagerHolder.getOpenTracingManager().getHandler().handleCloseFlowForcefully(dataUnit, messageContext);
        }
    }
}
Also used : EndFlowEvent(org.apache.synapse.aspects.flow.statistics.log.templates.EndFlowEvent) BasicStatisticDataUnit(org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit)

Aggregations

BasicStatisticDataUnit (org.apache.synapse.aspects.flow.statistics.data.raw.BasicStatisticDataUnit)1 EndFlowEvent (org.apache.synapse.aspects.flow.statistics.log.templates.EndFlowEvent)1