Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.DbusEvent


    Statement stmt = null;
    ResultSet rs = null;
    long id = -1;
    long scn = -1;
    String key = null;
    DbusEvent event = null;
    try
    {
      String tableName = logInfo.getLogTable();
      StringBuilder sql = new StringBuilder();
      sql.append("select id, srckey, scn, val from ");
      sql.append(tableName);
      sql.append(" where id = ( select max(id) from ");
      sql.append(tableName);
      sql.append(" )");
      stmt = _conn.createStatement();
      rs = stmt.executeQuery(sql.toString());
      if (rs.next())
      {
        int i = 1;
        id = rs.getLong(i++);
        String srcKey = rs.getString(i++);
        scn = rs.getLong(i++);
        ByteBuffer tmpBuffer = ByteBuffer.wrap(rs.getBytes(i));
        LOG.info("BUFFER SIZE:" + tmpBuffer.limit());
        event = eventFactory.createReadOnlyDbusEventFromBuffer(tmpBuffer,
            tmpBuffer.position());
        LOG.info("Last Row for log (" + logInfo + ") - ID :" + id
            + ", srcKey :" + srcKey + ", SCN :" + scn + ", Event :"
            + event.toString());
      }
      else
      {
        LOG.error("No ResultSet for query :" + sql.toString());
      }
View Full Code Here


    Assert.assertEquals(gg.getRateControl().getNumSleeps(), 0);
    DbusEventIterator iter  = mb.acquireIterator("test");
    int count = 0;
    long eventTs = 0;
    while(iter.hasNext()) {
      DbusEvent e = iter.next();
      if(count==1) { // first event prev control event
        eventTs = e.timestampInNanos();
      }

      count ++;
    }
     Assert.assertEquals("Event timestamp in Ns", timestamp, eventTs);
View Full Code Here

        if (curState.isSCNRegress())
        {
          _log.info("SCN Regress requested !! Sending a SCN Regress Message to dispatcher. Curr Ckpt :" + curState.getCheckpoint());

          DbusEvent regressEvent = getEventFactory().createSCNRegressEvent(new SCNRegressMessage(curState.getCheckpoint()));

          writeEventToRelayDispatcher(curState, regressEvent, "SCN Regress Event from ckpt :" + curState.getCheckpoint());
          curState.setSCNRegress(false);
        }
View Full Code Here

    try
    {
      Checkpoint cpForDispatcher = new Checkpoint(bootstrapCkpt.toString());
      cpForDispatcher.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
      DbusEvent cpEvent = getEventFactory().createCheckpointEvent(cpForDispatcher);
      writeEventToRelayDispatcher(curState, cpEvent, "Control Event to start bootstrap");
      curState.switchToBootstrapRequested();
    } catch (InterruptedException ie) {
      _log.error("Got interrupted while writing control message to bootstrap !!", ie);
      enqueueMessage(LifecycleMessage.createSuspendOnErroMessage(ie));
View Full Code Here

    eventsBuf.endEvents(100L);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    iter.next();
    DbusEvent event1 = iter.next();

    DatabusStreamConsumer logConsumer = new LoggingConsumer();
    SelectingDatabusCombinedConsumer sdccLogConsumer = new SelectingDatabusCombinedConsumer(logConsumer);

    DatabusV2ConsumerRegistration consumerReg =
View Full Code Here

            null);
    callback.setSourceMap(sourcesMap);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    DbusEvent event1 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event2 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event3 = iter.next();

    initMockStreamConsumer3EventFullLifecycle(mockConsumer, event1, event2, event3, keyCounts);

    assert3EventFullLifecycle(callback, event1, event2, event3);
View Full Code Here

            null);
    callback.setSourceMap(sourcesMap);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    DbusEvent event1 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event2 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event3 = iter.next();

    initMockFailingStreamConsumer3EventFullLifecycle(mockConsumer, event1, event2, event3, keyCounts);

    assert3EventFullLifecycleWithFailure(callback, event1, event2, event3);
View Full Code Here

            null);
    callback.setSourceMap(sourcesMap);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    DbusEvent event1 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event2 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event3 = iter.next();

    initMockExceptionStreamConsumer3EventFullLifecycle(mockConsumer, event1, event2, event3, keyCounts, exception);

    assert3EventFullLifecycleWithFailure(callback, event1, event2, event3);
View Full Code Here

            null);
    callback.setSourceMap(sourcesMap);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    DbusEvent event1 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event2 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event3 = iter.next();

    initMockStreamConsumer3EventFullLifecycle(mockConsumer1, event1, event2, event3, keyCounts);
    initMockStreamConsumer3EventFullLifecycle(mockConsumer2, event1, event2, event3, keyCounts);
    initMockStreamConsumer3EventFullLifecycle(mockConsumer3, event1, event2, event3, keyCounts);
View Full Code Here

            null);
    callback.setSourceMap(sourcesMap);

    DbusEventBuffer.DbusEventIterator iter = eventsBuf.acquireIterator("myIter1");
    assert iter.hasNext() : "unable to read event";
    DbusEvent event1 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event2 = iter.next();
    assert iter.hasNext() : "unable to read event";
    DbusEvent event3 = iter.next();

    initMockStreamConsumer3EventFullLifecycle(mockConsumer1, event1, event2, event3, keyCounts);
    initMockFailingStreamConsumer3EventFullLifecycle(mockConsumer2, event1, event2, event3, keyCounts);
    initMockStreamConsumer3EventFullLifecycle(mockConsumer3, event1, event2, event3, keyCounts);
View Full Code Here

TOP

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

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.