Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.DbusEventInfo


      try
      {
        writer.write(r, out);
        out.flush();

        result[i] = new DbusEventInfo(DbusOpcode.UPSERT, 1, (short)1, (short)1,
                                      System.nanoTime(),
                                      (short)1, SOURCE1_SCHEMAID,
                                      baos.toByteArray(), false, true);
        result[i].setEventSerializationVersion(_eventFactory.getVersion());
      }
View Full Code Here


  public static DbusEvent randomEvent(short srcId)
  {
    ByteBuffer serBuf = ByteBuffer.allocate(1000).order(_eventFactory.getByteOrder());
    try
    {
      DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT,
                                                  0L// Sequence number
                                                  (short) 0, // physical Partition
                                                  randomPositiveShort(),
                                                  System.currentTimeMillis(),
                                                  srcId,
                                                  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

                             byte[] value,
                             boolean enableTracing,
                             boolean isReplicated,
                             DbusEventsStatisticsCollector statsCollector)
  {
    DbusEventInfo eventInfo = new DbusEventInfo(null, 0L, pPartitionId, lPartitionId,
                                                timeStamp, srcId, schemaId, value, enableTracing,
                                                false);
    eventInfo.setReplicated(isReplicated);
    return appendEvent(key, seederChunkKey, eventInfo, statsCollector);
  }
View Full Code Here

                             byte[] schemaId,
                             byte[] value,
                             boolean enableTracing,
                             DbusEventsStatisticsCollector statsCollector)
  {
    DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT, sequenceId, pPartitionId, lPartitionId,
                                                timeStamp, srcId, schemaId, value, enableTracing,
                                                false);
    return appendEvent(key, seederChunkKey, eventInfo, statsCollector);
  }
View Full Code Here

            throw new DatabusException("Unknown opcode from dbUpdate for event with scn:" + scn);
          }


          //Construct the dbusEvent info
          DbusEventInfo dbusEventInfo = new DbusEventInfo(opCode,
                                                          scn,
                                                          (short)_pConfig.getId(),
                                                          lPartitionId,
                                                          timestamp,
                                                          sourceId,
                                                          schemaId.getByteArray(),
                                                          serializedValue,
                                                          false,
                                                          false);
          dbusEventInfo.setReplicated(dbUpdate.isReplicated());

          perSourceStats.addEventCycle(1, ti.getTransactionTimeRead(), serializedValue.length, scn);
          globalStats.addEventCycle(1, ti.getTransactionTimeRead(), serializedValue.length, scn);

          long tsEnd = System.currentTimeMillis();
View Full Code Here

      PhysicalPartition pPartition = new PhysicalPartition(pId, pSourceName);
      DbusEventBufferAppendable buf = bufMult.getDbusEventBufferAppendable(pPartition);
      DbusEventKey key = new DbusEventKey(123L);
      byte[] schemaId = relay1.getSchemaRegistryService().fetchSchemaIdForSourceNameAndVersion(srcs[0], 2).getByteArray();
      byte[] payload = RngUtils.randomString(100).getBytes(Charset.defaultCharset());
      DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT, 100L, (short)pId, (short)pId, 897L,
                                                  (short)srcId, schemaId, payload, false, true);
      eventInfo.setEventSerializationVersion(DbusEventFactory.DBUS_EVENT_V2);
      buf.startEvents();
      buf.appendEvent(key, eventInfo, null);
      buf.endEvents(100L, null);
      r1.start();
      log.info("Relay started");
View Full Code Here

   */
  private ByteBuffer addEvent(long scn, short srcId, byte[] schemaId,short pId, byte ver) throws KeyTypeNotImplementedException
  {
    DbusEventKey key = new DbusEventKey(123L);
    byte[] payload = RngUtils.randomString(100).getBytes(Charset.defaultCharset());
    DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT, scn, pId, pId, 897L,
                                                srcId, schemaId, payload, false, true);
    eventInfo.setEventSerializationVersion(ver);

    // serialize it into a buffer
    int newEventSize = DbusEventFactory.computeEventLength(key, eventInfo);

    // now create an end of window event
    DbusEventInfo eventInfoEOP = new DbusEventInfo(null, scn, pId, pId, // must be the same as physicalPartition
                                                   900L,
                                                   DbusEventInternalWritable.EOPMarkerSrcId,
                                                   DbusEventInternalWritable.emptyMd5,
                                                   DbusEventInternalWritable.EOPMarkerValue,
                                                   false, //enable tracing
                                                   true // autocommit
                                                   );
    eventInfoEOP.setEventSerializationVersion(_eventFactory.getVersion());

    // serialize it into buffer
    int newEventSizeEOP = DbusEventFactory.computeEventLength(DbusEventInternalWritable.EOPMarkerKey, eventInfoEOP);
    int totalSize = newEventSize + newEventSizeEOP;
    ByteBuffer serializationBuffer = ByteBuffer.allocate(totalSize);
View Full Code Here

    //Get the md5 for the schema
    SchemaId schemaId = SchemaId.createWithMd5(changeEntry.getSchema());

    byte[] payload = serializeEvent(changeEntry.getRecord());

    DbusEventInfo eventInfo = new DbusEventInfo(changeEntry.getOpCode(),
                                                changeEntry.getScn(),
                                                (short)_pSourceId,
                                                lPartitionId,
                                                changeEntry.getTimestampInNanos(),
                                                (short)_sourceId,
View Full Code Here

          //0 srcId not allowed
          srcId = 1;
        }
        //assumption: serialized event fits in maxEventSize
        ByteBuffer buf = ByteBuffer.allocate(maxEventSize).order(_eventFactory.getByteOrder());
        DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT,
                                                    0L, // sequence number
                                                    (short) 0, // physical Partition
                                                    RngUtils.randomPositiveShort(),
                                                    (beginningOfTime - ((numEvents - i) * 1000)) * 1000 * 1000,
                                                    //nanoseconds ; first event is numEvents seconds ago
                                                    srcId,
                                                    RngUtils.schemaMd5,
                                                    RngUtils.randomString(payloadSize).getBytes(Charset.defaultCharset()),
                                                    false,
                                                    false /*autoCommit */);
        eventInfo.setEventSerializationVersion(DbusEventFactory.DBUS_EVENT_V1)// make this explicit
        DbusEventFactory.serializeEvent(new DbusEventKey(RngUtils.randomLong()), buf, eventInfo);
        lastScn = (useLastEventAsScn) ? _startScn + ((i/windowSize) + 1) * (long)windowSize
                                      : _startScn + (i/windowSize) + 1;
        eventVector.add((DbusEvent)
            DbusEventFactoryForTesting.createReadOnlyDbusEventFromBuffer(buf, 0, lastScn, DbusEventFactory.DBUS_EVENT_V1));
View Full Code Here

  private DbusEventFactory _eventFactory = new DbusEventV2Factory();


  private DbusEvent createEvent(long timestampNs)
  {
    DbusEventInfo eventInfo = new DbusEventInfo(DbusOpcode.UPSERT,
                                                6004L,             // SCN
                                                (short) 1,         // physical partition ID
                                                (short) 1,         // logical partition ID
                                                timestampNs,
                                                (short) 1,         // srcId
View Full Code Here

TOP

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

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.