예제 #1
0
        public void FindMissingEvent(Object sender, UpdateEventArgs e)
        {
            var oldEvents = e.OldEvents;

            if (oldEvents == null)
            {
                // we don't care about events entering the window (new events)
                // this is because we must wait for C to arri
                return;
            }

            // Missing C events can be reported either through A or through B
            // We assume that duplicates are ok, if not, then streams A and B could be joined and then fed,
            // or duplicates could be removed via another statement as well.
            TxnEventA eventA = (TxnEventA)oldEvents[0]["A"];
            TxnEventB eventB = (TxnEventB)oldEvents[0]["B"];

            if (eventA != null)
            {
                Log.Debug("Missing TxnEventC event detected for TxnEventA " + eventA);
            }
            else
            {
                Log.Debug("Missing TxnEventC event detected for TxnEventB " + eventB);
            }
        }
예제 #2
0
        protected List <TxnEventBase> CreateNextTransaction()
        {
            List <TxnEventBase> t = new List <TxnEventBase>();

            long beginningStamp = DateTimeHelper.CurrentTimeMillis;

            //skip event 1 with probability 1 in 5000
            if (random.Next(5000) < 4998)
            {
                TxnEventA txnEventA = new TxnEventA(null, beginningStamp, fieldGenerator.GetRandomCustomer());
                t.Add(txnEventA);
            }

            long e2Stamp = fieldGenerator.randomLatency(beginningStamp);

            //skip event 2 with probability 1 in 1000
            if (random.Next(1000) < 9998)
            {
                TxnEventB txnEventB = new TxnEventB(null, e2Stamp);
                t.Add(txnEventB);
            }

            long e3Stamp = fieldGenerator.randomLatency(e2Stamp);

            //skip event 3 with probability 1 in 10000
            if (random.Next(10000) < 9998)
            {
                TxnEventC txnEventC = new TxnEventC(null, e3Stamp, fieldGenerator.GetRandomSupplier());
                t.Add(txnEventC);
            }
            else
            {
                Log.Debug(".createNextTransaction generated missing event");
            }

            return(t);
        }