Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.DbusEventKey


      ++ _eventNum;
      if ( (! e.isCheckpointMessage()) && (!e.isControlMessage()))
      {
        sequences.add(e.sequence());
        if ( e.isKeyNumber())
          keys.add(new DbusEventKey(e.key()));
        else
          keys.add(new DbusEventKey(e.keyBytes()));
      }
      LOG.info("TestConsumer: OnDataEvent : Sequence : " + e.sequence());
      return super.onDataEvent(e, eventDecoder);
    }
View Full Code Here


        for (long i = 0; i < numEvents; ++i)
        {
            String value = "{\"s\":\"value" + i + "\"}";
            try {
                eventsBuf.appendEvent(new DbusEventKey(keyBase + i), (short)0, (short)1, (short)0, srcId,
                        schemaId, value.getBytes("UTF-8"), false);
            } catch (UnsupportedEncodingException e) {
                //ignore
            }
            if (null != keyCounts) keyCounts.put(keyBase + i, new AtomicInteger(0));
View Full Code Here

      ++ _eventNum;
      if ( (! e.isCheckpointMessage()) && (!e.isControlMessage()))
      {
        sequences.add(e.sequence());
        if ( e.isKeyNumber())
          keys.add(new DbusEventKey(e.key()));
        else
          keys.add(new DbusEventKey(e.keyBytes()));
      }
      LOG.info("TestConsumer: OnDataEvent : Sequence : " + e.sequence());
      return super.onDataEvent(e, eventDecoder);
    }
View Full Code Here

      byte [] schema = "abcdefghijklmnop".getBytes(Charset.defaultCharset());
      final long prevScn = 99;
      final long eventScn = 101;
      buf.start(prevScn);
      buf.startEvents();
      Assert.assertTrue(buf.appendEvent(new DbusEventKey(1),
                                        (short) 100,
                                        (short) 0,
                                        System.currentTimeMillis() * 1000000,
                                        lid,
                                        schema,
View Full Code Here

        if (null != srcidCounts) srcidCounts.put(srcId, new AtomicInteger(0));

        for (long i = 0; i < numEvents; ++i)
        {
            String value = "{\"s\":\"value" + i + "\"}";
            eventsBuf.appendEvent(new DbusEventKey(keyBase + i), (short)0, (short)1, (short)0, srcId,
                    new byte[16], value.getBytes(Charset.defaultCharset()), false);
            if (null != keyCounts) keyCounts.put(keyBase + i, new AtomicInteger(0));
        }
    }
View Full Code Here

      if (i % winSize == 0)
      {
        if (i > 0) buf.endEvents(i);
        buf.startEvents();
      }
      DbusEventKey key =
          new DbusEventKey(RngUtils.randomString(rng, rng.nextInt(50)).getBytes("UTF-8"));
      buf.appendEvent(key, eventInfos[i], null);
      eventKeys.add(key);
    }
    buf.endEvents(eventInfos.length);
View Full Code Here

    ++ _eventNum;
    if ( (! e.isCheckpointMessage()) && (!e.isControlMessage()))
    {
      sequences.add(e.sequence());
      if ( e.isKeyNumber())
        keys.add(new DbusEventKey(e.key()));
      else
        keys.add(new DbusEventKey(e.keyBytes()));
    }
    LOG.info("TestConsumer: OnDataEvent : Sequence : " + e.sequence());
    return super.onDataEvent(e, eventDecoder);
  }
View Full Code Here

      byte[] defaultSchemaId = "abcdefghijklmnop".getBytes(Charset.defaultCharset());

    boolean enableTracing = (RngUtils.randomPositiveLong()%100L <= 1)// trace 1% samples
    for (int i = 0; i < numberOfEvents; ++i) {
      DbusEventKey key = new DbusEventKey(RngUtils.randomPositiveLong(keyMin, keyMax)); // random key between 0 and 100M
      long scn = startScn + (i / scnDiff);
      //short srcId = sources.get((Integer) (RngUtils.randomPositiveShort() % sources.size())).getId().shortValue();
      short srcId = sources.get(i/eventsPerSource).getId().shortValue();
      byte[] schemaId=(_schemaIds != null) ? _schemaIds.get((long) srcId) : defaultSchemaId;
View Full Code Here

                                                  schemaMd5,
                                                  randomString(20).getBytes(Charset.defaultCharset()),
                                                  randomPositiveShort() % 100 <= 1,
                                                  false /* autoCommit */);
      eventInfo.setEventSerializationVersion(DbusEventFactory.DBUS_EVENT_V1)// make this explicit
      DbusEventFactory.serializeEvent(new DbusEventKey(randomLong()), serBuf, eventInfo);
    }
    catch (KeyTypeNotImplementedException e1)
    {
      throw new RuntimeException(e1);
    }
View Full Code Here

  private DbusEventBuffer createSimpleBuffer()
  {
    DbusEventBuffer buf  = new DbusEventBuffer(_bufCfg);
    buf.start(0);
    buf.startEvents();
    buf.appendEvent(new DbusEventKey(1), (short)1, (short)1, System.nanoTime(), (short)1,
                    new byte[16], new byte[100], false, null);
    buf.appendEvent(new DbusEventKey(2), (short)1, (short)1, System.nanoTime(), (short)1,
                    new byte[16], new byte[100], false, null);
    buf.endEvents(10);
    return buf;
  }
View Full Code Here

TOP

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

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.