Package com.espertech.esper.epl.named

Examples of com.espertech.esper.epl.named.NamedWindowConsumerView


                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        namedWindowTailViews[i] = consumerView;
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // determine preload/postload filter for index access
                        if (!namedSpec.getFilterExpressions().isEmpty()) {
                            namedWindowFilters[streamNum] = namedSpec.getFilterExpressions();
                            try {
                                StreamTypeServiceImpl types = new StreamTypeServiceImpl(consumerView.getEventType(), consumerView.getEventType().getName(), false, services.getEngineURI());
                                LinkedHashMap<String, Pair<EventType, String>> tagged = new LinkedHashMap<String, Pair<EventType, String>>();
                                namedWindowPostloadFilters[i] = FilterSpecCompiler.makeFilterSpec(types.getEventTypes()[0], types.getStreamNames()[0],
                                        namedSpec.getFilterExpressions(), null, tagged, tagged, types, null, statementContext, Collections.singleton(0));
                            }
                            catch (Exception ex) {
                                log.warn("Unexpected exception analyzing filter paths: " + ex.getMessage(), ex);
                            }
                        }

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
                        if (preload) {
                            if (isRecoveringResilient && numStreams < 2) {
                                preload = false;
                            }
                        }
                        if (preload) {
                            final boolean yesRecoveringResilient = isRecoveringResilient;
                            final FilterSpecCompiled preloadFilterSpec = namedWindowPostloadFilters[i];
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    Collection<EventBean> snapshot = consumerView.snapshotNoLock(preloadFilterSpec, statementContext.getAnnotations());
                                    List<EventBean> eventsInWindow = new ArrayList<EventBean>(snapshot.size());
                                    ExprNodeUtility.applyFilterExpressionsIterable(snapshot, namedSpec.getFilterExpressions(), agentInstanceContext, eventsInWindow);
                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                                    }
                                }
                            });
View Full Code Here


                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        namedWindowTailViews[i] = consumerView;
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // determine preload/postload filter for index access
                        if (!namedSpec.getFilterExpressions().isEmpty()) {
                            namedWindowFilters[streamNum] = namedSpec.getFilterExpressions();
                            try {
                                StreamTypeServiceImpl types = new StreamTypeServiceImpl(consumerView.getEventType(), consumerView.getEventType().getName(), false, services.getEngineURI());
                                LinkedHashMap<String, Pair<EventType, String>> tagged = new LinkedHashMap<String, Pair<EventType, String>>();
                                namedWindowPostloadFilters[i] = FilterSpecCompiler.makeFilterSpec(types.getEventTypes()[0], types.getStreamNames()[0],
                                        namedSpec.getFilterExpressions(), null, tagged, tagged, types, null, statementContext, Collections.singleton(0));
                            }
                            catch (Exception ex) {
                                log.warn("Unexpected exception analyzing filter paths: " + ex.getMessage(), ex);
                            }
                        }

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
                        if (preload) {
                            if (isRecoveringResilient && numStreams < 2) {
                                preload = false;
                            }
                        }
                        if (preload) {
                            final boolean yesRecoveringResilient = isRecoveringResilient;
                            final FilterSpecCompiled preloadFilterSpec = namedWindowPostloadFilters[i];
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    Collection<EventBean> snapshot = consumerView.snapshot(preloadFilterSpec, statementContext.getAnnotations());
                                    List<EventBean> eventsInWindow = new ArrayList<EventBean>(snapshot.size());
                                    ExprNodeUtility.applyFilterExpressionsIterable(snapshot, namedSpec.getFilterExpressions(), agentInstanceContext, eventsInWindow);
                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                                    }
                                }
                            });
View Full Code Here

        this.optPropertyEvaluator = optPropertyEvaluator;
    }

    public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext) {
        NamedWindowConsumerDesc consumerDesc = new NamedWindowConsumerDesc(filterExpressions, optPropertyEvaluator, agentInstanceContext);
        NamedWindowConsumerView consumerView = processor.addConsumer(consumerDesc);
        return new ViewableActivationResult(consumerView, consumerView, null);
    }
View Full Code Here

                    NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // preload view for stream unless the expiry policy is batch window
                        ArrayList<EventBean> eventsInWindow = new ArrayList<EventBean>();
                        if (!consumerView.getTailView().isParentBatchWindow())
                        {
                            for (EventBean aConsumerView : consumerView)
                            {
                                eventsInWindow.add(aConsumerView);
                            }
                        }
                        if (!eventsInWindow.isEmpty() && !isRecoveringResilient)
                        {
                            EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                            view.update(newEvents, null);
                            if (joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                            }
                        }
                    }
View Full Code Here

                    NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        if (!consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext() && !isRecoveringResilient)
                        {
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    ArrayList<EventBean> eventsInWindow = new ArrayList<EventBean>();
                                    for (EventBean aConsumerView : consumerView) {
                                        eventsInWindow.add(aConsumerView);
                                    }

                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                                    }
                                }
                            });
View Full Code Here

        this.optPropertyEvaluator = optPropertyEvaluator;
    }

    public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext, boolean isSubselect) {
        NamedWindowConsumerDesc consumerDesc = new NamedWindowConsumerDesc(filterExpressions, optPropertyEvaluator, agentInstanceContext);
        NamedWindowConsumerView consumerView = processor.addConsumer(consumerDesc, isSubselect);
        return new ViewableActivationResult(consumerView, consumerView, null);
    }
View Full Code Here

                    NamedWindowConsumerStreamSpec namedSpec = (NamedWindowConsumerStreamSpec) streamSpec;
                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
                        if (preload) {
                            if (isRecoveringResilient && numStreams < 2) {
                                preload = false;
                            }
                        }
                        if (preload) {
                            final boolean yesRecoveringResilient = isRecoveringResilient;
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    ArrayList<EventBean> eventsInWindow = new ArrayList<EventBean>();
                                    for (EventBean aConsumerView : consumerView) {
                                        eventsInWindow.add(aConsumerView);
                                    }

                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                                    }
                                }
                            });
View Full Code Here

        this.optPropertyEvaluator = optPropertyEvaluator;
    }

    public ViewableActivationResult activate(AgentInstanceContext agentInstanceContext, boolean isSubselect, boolean isRecoveringResilient) {
        NamedWindowConsumerDesc consumerDesc = new NamedWindowConsumerDesc(filterExpressions, optPropertyEvaluator, agentInstanceContext);
        NamedWindowConsumerView consumerView = processor.addConsumer(consumerDesc, isSubselect);
        return new ViewableActivationResult(consumerView, consumerView, null, null, false, false);
    }
View Full Code Here

                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        namedWindowTailViews[i] = consumerView;
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // determine preload/postload filter for index access
                        if (!namedSpec.getFilterExpressions().isEmpty()) {
                            namedWindowFilters[streamNum] = namedSpec.getFilterExpressions();
                            try {
                                StreamTypeServiceImpl types = new StreamTypeServiceImpl(consumerView.getEventType(), consumerView.getEventType().getName(), false, services.getEngineURI());
                                LinkedHashMap<String, Pair<EventType, String>> tagged = new LinkedHashMap<String, Pair<EventType, String>>();
                                namedWindowPostloadFilters[i] = FilterSpecCompiler.makeFilterSpec(types.getEventTypes()[0], types.getStreamNames()[0],
                                        namedSpec.getFilterExpressions(), null, tagged, tagged, types, null, statementContext, Collections.singleton(0));
                            }
                            catch (Exception ex) {
                                log.warn("Unexpected exception analyzing filter paths: " + ex.getMessage(), ex);
                            }
                        }

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
                        if (preload) {
                            if (isRecoveringResilient && numStreams < 2) {
                                preload = false;
                            }
                        }
                        if (preload) {
                            final boolean yesRecoveringResilient = isRecoveringResilient;
                            final FilterSpecCompiled preloadFilterSpec = namedWindowPostloadFilters[i];
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    Collection<EventBean> snapshot = consumerView.snapshot(preloadFilterSpec, statementContext.getAnnotations());
                                    List<EventBean> eventsInWindow = new ArrayList<EventBean>(snapshot.size());
                                    ExprNodeUtility.applyFilterExpressionsIterable(snapshot, namedSpec.getFilterExpressions(), agentInstanceContext, eventsInWindow);
                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute();
                                    }
                                }
                            });
View Full Code Here

                    NamedWindowProcessor processor = services.getNamedWindowService().getProcessor(namedSpec.getWindowName());
                    NamedWindowProcessorInstance processorInstance = processor.getProcessorInstance(agentInstanceContext);
                    if (processorInstance != null) {
                        final NamedWindowTailViewInstance consumerView = processorInstance.getTailViewInstance();
                        namedWindowTailViews[i] = consumerView;
                        final NamedWindowConsumerView view = (NamedWindowConsumerView) viewableActivationResult[i].getViewable();

                        // determine preload/postload filter for index access
                        if (!namedSpec.getFilterExpressions().isEmpty()) {
                            namedWindowFilters[streamNum] = namedSpec.getFilterExpressions();
                            try {
                                StreamTypeServiceImpl types = new StreamTypeServiceImpl(consumerView.getEventType(), consumerView.getEventType().getName(), false, services.getEngineURI());
                                LinkedHashMap<String, Pair<EventType, String>> tagged = new LinkedHashMap<String, Pair<EventType, String>>();
                                namedWindowPostloadFilters[i] = FilterSpecCompiler.makeFilterSpec(types.getEventTypes()[0], types.getStreamNames()[0],
                                        namedSpec.getFilterExpressions(), null, tagged, tagged, types, null, statementContext, Collections.singleton(0));
                            }
                            catch (Exception ex) {
                                log.warn("Unexpected exception analyzing filter paths: " + ex.getMessage(), ex);
                            }
                        }

                        // preload view for stream unless the expiry policy is batch window
                        Iterator<EventBean> consumerViewIterator = consumerView.iterator();
                        boolean preload = !consumerView.getTailView().isParentBatchWindow() && consumerViewIterator.hasNext();
                        if (preload) {
                            if (isRecoveringResilient && numStreams < 2) {
                                preload = false;
                            }
                        }
                        if (preload) {
                            final boolean yesRecoveringResilient = isRecoveringResilient;
                            final FilterSpecCompiled preloadFilterSpec = namedWindowPostloadFilters[i];
                            preloadList.add(new StatementAgentInstancePreload() {
                                public void executePreload() {
                                    Collection<EventBean> snapshot = consumerView.snapshot(preloadFilterSpec, statementContext.getAnnotations());
                                    List<EventBean> eventsInWindow = new ArrayList<EventBean>(snapshot.size());
                                    ExprNodeUtility.applyFilterExpressionsIterable(snapshot, namedSpec.getFilterExpressions(), agentInstanceContext, eventsInWindow);
                                    EventBean[] newEvents = eventsInWindow.toArray(new EventBean[eventsInWindow.size()]);
                                    view.update(newEvents, null);
                                    if (!yesRecoveringResilient && joinPreloadMethod != null && !joinPreloadMethod.isPreloading() && agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable() != null) {
                                        agentInstanceContext.getEpStatementAgentInstanceHandle().getOptionalDispatchable().execute(agentInstanceContext);
                                    }
                                }
                            });
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.named.NamedWindowConsumerView

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.