Example #1
0
  public RowLogShardImpl(String id, Configuration configuration, RowLog rowLog, int batchSize)
      throws IOException {
    this.id = id;
    this.rowLog = rowLog;
    this.batchSize = batchSize;

    String tableName = rowLog.getId() + "-" + id;
    HBaseAdmin admin = new HBaseAdmin(configuration);
    try {
      admin.getTableDescriptor(Bytes.toBytes(tableName));
    } catch (TableNotFoundException e) {
      HTableDescriptor tableDescriptor = new HTableDescriptor(tableName);
      tableDescriptor.addFamily(new HColumnDescriptor(MESSAGES_CF));
      admin.createTable(tableDescriptor);
    }

    table = new LocalHTable(configuration, tableName);
  }
Example #2
0
 public void putMessage(RowLogMessage message) throws RowLogException {
   for (RowLogSubscription subscription : rowLog.getSubscriptions()) {
     putMessage(message, subscription.getId());
   }
 }