Package com.espertech.esper.dataflow.interfaces

Examples of com.espertech.esper.dataflow.interfaces.EPDataFlowEmitter


            // determine the number of output streams
            Object producingOp = operators.get(producerOpNum);
            int numOutputStreams = operatorMetadata.get(producerOpNum).getOperatorSpec().getOutput().getItems().size();
            List<ObjectBindingPair>[] targets = getOperatorConsumersPerStream(numOutputStreams, producerOpNum, operators, operatorMetadata, bindings);

            EPDataFlowEmitter runtimeContext = generateRuntimeContext(dataFlowName, producerOpNum, operatorPrettyPrint, dataFlowSignalManager, targets, options);

            if (options.isOperatorStatistics()) {
                runtimeContext = new EPDataFlowEmitterWrapperWStatistics(runtimeContext, producerOpNum, statisticsProvider, options.isCpuStatistics());
            }

            JavaClassHelper.setFieldForAnnotation(producingOp, DataFlowContext.class, runtimeContext);
            runtimeContexts.put(producerOpNum, runtimeContext);
        }

        // Second pass: hook punctuation such that it gets forwarded
        for (int producerOpNum : operatorBuildOrder) {
            String operatorPrettyPrint = operatorMetadata.get(producerOpNum).getOperatorPrettyPrint();
            if (log.isDebugEnabled()) {
                log.debug("Handling signals for " + operatorPrettyPrint);
            }

            // determine consumers that receive punctuation
            Set<Integer> consumingOperatorsWithPunctuation = new HashSet<Integer>();
            for (LogicalChannelBinding binding : bindings) {
                if (!binding.getLogicalChannel().getOutputPort().isHasPunctuation() || binding.getLogicalChannel().getOutputPort().getProducingOpNum() != producerOpNum) {
                    continue;
                }
                consumingOperatorsWithPunctuation.add(binding.getLogicalChannel().getConsumingOpNum());
            }

            // hook up a listener for each
            for (int consumerPunc : consumingOperatorsWithPunctuation) {
                final EPDataFlowEmitter context = runtimeContexts.get(consumerPunc);
                if (context == null) {
                    continue;
                }
                dataFlowSignalManager.addSignalListener(producerOpNum, new DataFlowSignalListener() {
                    public void processSignal(EPDataFlowSignal signal) {
                        context.submitSignal(signal);
                    }
                });
            }
        }
View Full Code Here


            // determine the number of output streams
            Object producingOp = operators.get(producerOpNum);
            int numOutputStreams = operatorMetadata.get(producerOpNum).getOperatorSpec().getOutput().getItems().size();
            List<ObjectBindingPair>[] targets = getOperatorConsumersPerStream(numOutputStreams, producerOpNum, operators, operatorMetadata, bindings);

            EPDataFlowEmitter runtimeContext = generateRuntimeContext(statementContext.getEngineURI(), statementContext.getStatementName(), audit, dataFlowName, producerOpNum, operatorPrettyPrint, dataFlowSignalManager, targets, options);

            if (options.isOperatorStatistics()) {
                runtimeContext = new EPDataFlowEmitterWrapperWStatistics(runtimeContext, producerOpNum, statisticsProvider, options.isCpuStatistics());
            }

            JavaClassHelper.setFieldForAnnotation(producingOp, DataFlowContext.class, runtimeContext);
            runtimeContexts.put(producerOpNum, runtimeContext);
        }

        // Second pass: hook punctuation such that it gets forwarded
        for (int producerOpNum : operatorBuildOrder) {
            String operatorPrettyPrint = operatorMetadata.get(producerOpNum).getOperatorPrettyPrint();
            if (log.isDebugEnabled()) {
                log.debug("Handling signals for " + operatorPrettyPrint);
            }

            // determine consumers that receive punctuation
            Set<Integer> consumingOperatorsWithPunctuation = new HashSet<Integer>();
            for (LogicalChannelBinding binding : bindings) {
                if (!binding.getLogicalChannel().getOutputPort().isHasPunctuation() || binding.getLogicalChannel().getOutputPort().getProducingOpNum() != producerOpNum) {
                    continue;
                }
                consumingOperatorsWithPunctuation.add(binding.getLogicalChannel().getConsumingOpNum());
            }

            // hook up a listener for each
            for (int consumerPunc : consumingOperatorsWithPunctuation) {
                final EPDataFlowEmitter context = runtimeContexts.get(consumerPunc);
                if (context == null) {
                    continue;
                }
                dataFlowSignalManager.addSignalListener(producerOpNum, new DataFlowSignalListener() {
                    public void processSignal(EPDataFlowSignal signal) {
                        context.submitSignal(signal);
                    }
                });
            }
        }
View Full Code Here

TOP

Related Classes of com.espertech.esper.dataflow.interfaces.EPDataFlowEmitter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.