Ejemplo n.º 1
0
 public void Next()
 {
     if (lines.MoveNext()) {
         dataFlowEmitter.Submit(new object[] {lines.Current});
     }
     else {
         dataFlowEmitter.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
     }
 }
 public void Next()
 {
     lifecycle.Add("Next(numrows=" + numrows + ")");
     if (numrows < 2)
     {
         numrows++;
         graphContext.Submit("E" + numrows);
     }
     else
     {
         graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
     }
 }
Ejemplo n.º 3
0
 public void Next()
 {
     _lifecycle.Add("next(numrows=" + _numrows + ")");
     if (_numrows < 2)
     {
         _numrows++;
         _graphContext.Submit("E" + _numrows);
     }
     else
     {
         _graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl()
         {
         });
     }
 }
Ejemplo n.º 4
0
 public void Next()
 {
     var next = emittables.Pop();
     if (next is EPDataFlowSignal)
     {
         var signal = (EPDataFlowSignal) next;
         graphContext.SubmitSignal(signal);
     }
     else if (next is PortAndMessagePair)
     {
         var pair = (PortAndMessagePair) next;
         graphContext.SubmitPort(pair.Port, pair.Message);
     }
     else
     {
         graphContext.Submit(next);
     }
 }
Ejemplo n.º 5
0
        public void Next()
        {
            if (enumerator.MoveNext()) {
                var next = enumerator.Current;
                if (log.IsDebugEnabled) {
                    log.Debug("submitting row " + next.RenderAny());
                }

                graphContext.Submit(next);
            }
            else {
                if (log.IsDebugEnabled) {
                    log.Debug("submitting punctuation");
                }

                graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
            }
        }
Ejemplo n.º 6
0
 public void Next()
 {
     if (_enumerator.MoveNext())
     {
         Object[] next = _enumerator.Current;
         if (Log.IsDebugEnabled)
         {
             Log.Debug("submitting row " + next.Render());
         }
         _graphContext.Submit(next);
     }
     else
     {
         if (Log.IsDebugEnabled)
         {
             Log.Debug("submitting punctuation");
         }
         _graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
     }
 }
Ejemplo n.º 7
0
        public void Next()
        {
            CurrentCount++;
            if (instructions.Length <= CurrentCount) {
                graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
                return;
            }

            var next = instructions[CurrentCount];
            if (next is CountDownLatch) {
                var latch = (CountDownLatch) next;
                latch.Await();
            }
            else if (next.IsInt64() || next.IsInt32()) {
                Thread.Sleep(next.AsInt32());
            }
            else if (next is EPRuntimeException) {
                var ex = (EPRuntimeException) next;
                throw new EPRuntimeException("Support-graph-source generated exception: " + ex.Message, ex);
            }
            else {
                graphContext.Submit(next);
            }
        }
Ejemplo n.º 8
0
 public void SubmitSignal(EPDataFlowSignal signal)
 {
     dataFlowEmitter.SubmitSignal(signal);
 }
Ejemplo n.º 9
0
 public void SubmitSignal(EPDataFlowSignal signal)
 {
     _facility.SubmitSignal(signal);
 }
Ejemplo n.º 10
0
        public void Next()
        {
            if (iterationNumber == 0 && initialDelayMSec > 0) {
                try {
                    Thread.Sleep((int) initialDelayMSec);
                }
                catch (ThreadInterruptedException) {
                    graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
                }
            }

            if (iterationNumber > 0 && periodDelayMSec > 0) {
                var nsecDelta = lastSendTime - PerformanceObserver.NanoTime;
                var sleepTime = periodDelayMSec - nsecDelta / 1000000;
                if (sleepTime > 0) {
                    try {
                        Thread.Sleep((int) sleepTime);
                    }
                    catch (ThreadInterruptedException) {
                        graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
                    }
                }
            }

            if (iterations > 0 && iterationNumber >= iterations) {
                graphContext.SubmitSignal(new EPDataFlowSignalFinalMarkerImpl());
            }
            else {
                iterationNumber++;
                ExprEvaluator[] evaluators = factory.PropertyEvaluators;
                if (evaluators != null) {
                    var row = new object[evaluators.Length];
                    for (var i = 0; i < row.Length; i++) {
                        if (evaluators[i] != null) {
                            row[i] = evaluators[i].Evaluate(null, true, null);
                        }
                    }

                    if (log.IsDebugEnabled) {
                        log.Debug("BeaconSource submitting row " + row.RenderAny());
                    }

                    EventBeanManufacturer manufacturer = factory.Manufacturer;
                    if (manufacturer == null) {
                        SubmitAndDone(row);
                        return;
                    }

                    if (!factory.IsProduceEventBean && additionalProperties == null) {
                        var outputEvent = manufacturer.MakeUnderlying(row);
                        SubmitAndDone(outputEvent);
                        return;
                    }

                    var @event = manufacturer.Make(row);
                    if (additionalProperties != null) {
                        foreach (var pair in additionalProperties) {
                            pair.First.Write(pair.Second, @event);
                        }
                    }

                    if (!factory.IsProduceEventBean) {
                        SubmitAndDone(@event.Underlying);
                        return;
                    }

                    SubmitAndDone(@event);
                }
                else {
                    if (log.IsDebugEnabled) {
                        log.Debug("BeaconSource submitting empty row");
                    }

                    SubmitAndDone(new object[0]);
                }
            }
        }