@Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { // Subscriber can get notification of newly add partition in a // particular table by listening on a topic named "dbName.tableName" // and message selector string as "HCAT_EVENT = HCAT_ADD_PARTITION" if (partitionEvent.getStatus()) { Table table = partitionEvent.getTable(); String topicName = getTopicName(table); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildAddPartitionMessage(table, partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
/** * @param partitionEvent partition event * @throws MetaException */ @Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { Table t = partitionEvent.getTable(); PartitionFilesIterator fileIter = MetaStoreUtils.isExternalTable(t) ? null : new PartitionFilesIterator(partitionEvent.getPartitionIterator(), t); EventMessage msg = MessageBuilder.getInstance() .buildAddPartitionMessage(t, partitionEvent.getPartitionIterator(), fileIter); MessageSerializer serializer = msgEncoder.getSerializer(); NotificationEvent event = new NotificationEvent(0, now(), EventType.ADD_PARTITION.toString(), serializer.serialize(msg)); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, partitionEvent); }
Assert.assertTrue(partEvent.getStatus()); Partition part = msc.getPartition("hive2038", "tmptbl", "b=2011"); Partition partAdded = partEvent.getPartitionIterator().next(); partAdded.setWriteId(part.getWriteId()); validateAddPartition(part, partAdded); AddPartitionEvent multiplePartitionEvent = (AddPartitionEvent)(notifyList.get(listSize-1)); assertEquals("Unexpected table value.", table, multiplePartitionEvent.getTable()); List<Partition> multiParts = Lists.newArrayList(multiplePartitionEvent.getPartitionIterator()); assertEquals("Unexpected number of partitions in event!", 3, multiParts.size()); assertEquals("Unexpected partition value.", partition1.getValues(), multiParts.get(0).getValues()); Partition partAppended = appendPartEvent.getPartitionIterator().next(); validateAddPartition(newPart, partAppended);
/** * @param partitionEvent partition event * @throws MetaException */ @Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { Table t = partitionEvent.getTable(); String msg = msgFactory .buildAddPartitionMessage(t, partitionEvent.getPartitionIterator(), new PartitionFilesIterator(partitionEvent.getPartitionIterator(), t)).toString(); NotificationEvent event = new NotificationEvent(0, now(), EventType.ADD_PARTITION.toString(), msg); event.setCatName(t.isSetCatName() ? t.getCatName() : DEFAULT_CATALOG_NAME); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); process(event, partitionEvent); }
@Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { // Subscriber can get notification of newly add partition in a // particular table by listening on a topic named "dbName.tableName" // and message selector string as "HCAT_EVENT = HCAT_ADD_PARTITION" if (partitionEvent.getStatus()) { Table table = partitionEvent.getTable(); String topicName = getTopicName(table); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildAddPartitionMessage(table, partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
@Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { // Subscriber can get notification of newly add partition in a // particular table by listening on a topic named "dbName.tableName" // and message selector string as "HCAT_EVENT = HCAT_ADD_PARTITION" if (partitionEvent.getStatus()) { Table table = partitionEvent.getTable(); String topicName = getTopicName(table); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildAddPartitionMessage(table, partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
@Override public void onAddPartition(AddPartitionEvent partitionEvent) throws MetaException { // Subscriber can get notification of newly add partition in a // particular table by listening on a topic named "dbName.tableName" // and message selector string as "HCAT_EVENT = HCAT_ADD_PARTITION" if (partitionEvent.getStatus()) { Table table = partitionEvent.getTable(); String topicName = getTopicName(table); if (topicName != null && !topicName.equals("")) { send(messageFactory.buildAddPartitionMessage(table, partitionEvent.getPartitionIterator()), topicName); } else { LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partitionEvent.getTable().getDbName() + "." + partitionEvent.getTable().getTableName() + " To enable notifications for this table, please do alter table set properties (" + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + "=<dbname>.<tablename>) or whatever you want topic name to be."); } } }
/** * @param partitionEvent partition event * @throws MetaException */ public void onAddPartition (AddPartitionEvent partitionEvent) throws MetaException { Table t = partitionEvent.getTable(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_ADD_PARTITION_EVENT, msgFactory.buildAddPartitionMessage(t, partitionEvent.getPartitionIterator()).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); enqueue(event); }
/** * @param partitionEvent partition event * @throws MetaException */ public void onAddPartition (AddPartitionEvent partitionEvent) throws MetaException { Table t = partitionEvent.getTable(); NotificationEvent event = new NotificationEvent(0, now(), HCatConstants.HCAT_ADD_PARTITION_EVENT, msgFactory.buildAddPartitionMessage(t, partitionEvent.getPartitionIterator()).toString()); event.setDbName(t.getDbName()); event.setTableName(t.getTableName()); enqueue(event); }