Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.StreamEventsArgs


      tReader.setDaemon(true);
      tReader.start();
      try
      {
        log.info("send both windows");
        StreamEventsResult streamRes = srcEventsBuf.streamEvents(cp, writerStream, new StreamEventsArgs(win1Size));
        Assert.assertEquals("num events streamed should equal total number of events plus 2", // EOP events, presumably?
                            numEvents + 2, streamRes.getNumEventsStreamed());

        TestUtil.assertWithBackoff(new ConditionCheck()
        {
View Full Code Here


      tReader.start();

      try
      {
        log.info("send first window -- that one should be OK");
        StreamEventsResult streamRes = srcEventsBuf.streamEvents(cp, writerStream, new StreamEventsArgs(win1Size));
        Assert.assertEquals(numEventsPerWindow + 1, streamRes.getNumEventsStreamed());

        TestUtil.assertWithBackoff(new ConditionCheck()
        {
          @Override
          public boolean check()
          {
            return 1 == callbackStats.getNumSysEventsProcessed();
          }
        }, "first window processed", 5000, log);

        log.info("send the second partial window -- that one should cause an error");
        streamRes = srcEventsBuf.streamEvents(cp, writerStream, new StreamEventsArgs(win2Size));
        Assert.assertEquals(numOfFailureEvent - numEventsPerWindow, streamRes.getNumEventsStreamed());

        log.info("wait for dispatcher to finish");
        TestUtil.assertWithBackoff(new ConditionCheck()
        {
          @Override
          public boolean check()
          {
            log.info("events received: " + callbackStats.getNumDataEventsReceived());
            return numOfFailureEvent <= callbackStats.getNumDataEventsProcessed();
          }
        }, "all events until the error processed", 5000, log);

        log.info("all data events have been received but no EOW");
        Assert.assertEquals(numOfFailureEvent, clientStats.getTotalStats().getNumDataEvents());
        Assert.assertEquals(1, clientStats.getTotalStats().getNumSysEvents());
        //at least one failing event therefore < numOfFailureEvent events can be processed
        Assert.assertTrue(numOfFailureEvent <= callbackStats.getNumDataEventsProcessed());
        //onDataEvent callbacks for e2_1 and e2_2 get cancelled
        Assert.assertEquals(2, callbackStats.getNumDataErrorsProcessed());
        //only one EOW
        Assert.assertEquals(1, callbackStats.getNumSysEventsProcessed());

        log.info("Send the remainder of the window");
        streamRes = srcEventsBuf.streamEvents(cp, writerStream, new StreamEventsArgs(100000));
        //remaining events + EOWs
        Assert.assertEquals(srcTestEvents.size() + numWindows - (numOfFailureEvent + 1),
                            streamRes.getNumEventsStreamed());

        log.info("wait for the rollback");
View Full Code Here

  {
    ChannelBuffer tmpBuf = ChannelBuffers.buffer(new DbusEventV1Factory().getByteOrder(), maxSize);
    OutputStream tmpOS = new ChannelBufferOutputStream(tmpBuf);
    WritableByteChannel tmpChannel = java.nio.channels.Channels.newChannel(tmpOS);

    StreamEventsArgs args = new StreamEventsArgs(maxSize).setStatsCollector(stats);

    buf.streamEvents(cp, tmpChannel, args);
    tmpChannel.close();
    return tmpBuf;
  }
View Full Code Here

      Checkpoint cp = new Checkpoint();
      //is there anything from the checkpoint I can infer that it's end of stream? control message?
      cp.setFlexible();
      do {
        int streamedEvents=0;
        StreamEventsArgs args = new StreamEventsArgs(_batchsize).setStatsCollector(_stats);
        while ((streamedEvents = _buffer.streamEvents(cp, _channel, args).getNumEventsStreamed()) > 0) {
          _count += streamedEvents;
        }
        //the writer hangs around - cannot count events; cp provides current window and window offset;
        //and streamedEvents has the count of all events - not just data events
View Full Code Here

TOP

Related Classes of com.linkedin.databus.core.StreamEventsArgs

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.