@Override
  public void onAddPrimaryKey(AddPrimaryKeyEvent addPrimaryKeyEvent) throws MetaException {
    List<SQLPrimaryKey> cols = addPrimaryKeyEvent.getPrimaryKeyCols();
    if (cols.size() > 0) {
      AddPrimaryKeyMessage msg = MessageBuilder.getInstance()
          .buildAddPrimaryKeyMessage(addPrimaryKeyEvent.getPrimaryKeyCols());
      NotificationEvent event = new NotificationEvent(0, now(), EventType.ADD_PRIMARYKEY.toString(),
          msgEncoder.getSerializer().serialize(msg));
      event.setCatName(cols.get(0).isSetCatName() ? cols.get(0).getCatName() : getDefaultCatalog(conf));
      event.setDbName(cols.get(0).getTable_db());
      event.setTableName(cols.get(0).getTable_name());
      process(event, addPrimaryKeyEvent);
    }
  }
@param addPrimaryKeyEvent add primary key event
@throws MetaException
hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java