Index: src/java/org/apache/hcatalog/listener/NotificationListener.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/java/org/apache/hcatalog/listener/NotificationListener.java (revision 1236032) +++ src/java/org/apache/hcatalog/listener/NotificationListener.java (revision ) @@ -91,16 +91,9 @@ private static String getTopicName(Partition partition, ListenerEvent partitionEvent) throws MetaException { try { - String topicName = partitionEvent.getHandler() + return partitionEvent.getHandler() .get_table(partition.getDbName(), partition.getTableName()) .getParameters().get(HCatConstants.HCAT_MSGBUS_TOPIC_NAME); - if (topicName == null) { - throw new MetaException( - "Topic name not found in metastore. Please do alter table set properties (" - + HCatConstants.HCAT_MSGBUS_TOPIC_NAME - + "=dbname.tablename) or whatever you want topic name to be."); - } - return topicName; } catch (NoSuchObjectException e) { throw new MetaException(e.toString()); } @@ -115,8 +108,17 @@ Partition partition = partitionEvent.getPartition(); String topicName = getTopicName(partition, partitionEvent); + if (topicName != null && !topicName.equals("")) { - send(partition, topicName, HCatConstants.HCAT_ADD_PARTITION_EVENT); - } + send(partition, topicName, HCatConstants.HCAT_ADD_PARTITION_EVENT); + } + else { + LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partition.getDbName() + + "." + partition.getTableName() + + " To enable notifications for this table, please do alter table set properties (" + + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + + "=.) or whatever you want topic name to be."); + } + } } @@ -137,7 +139,16 @@ sd.setParameters(new HashMap()); sd.getSerdeInfo().setParameters(new HashMap()); String topicName = getTopicName(partition, partitionEvent); + if (topicName != null && !topicName.equals("")) { - send(partition, topicName, HCatConstants.HCAT_DROP_PARTITION_EVENT); + send(partition, topicName, HCatConstants.HCAT_DROP_PARTITION_EVENT); + } + else { + LOG.info("Topic name not found in metastore. Suppressing HCatalog notification for " + partition.getDbName() + + "." + partition.getTableName() + + " To enable notifications for this table, please do alter table set properties (" + + HCatConstants.HCAT_MSGBUS_TOPIC_NAME + + "=.) or whatever you want topic name to be."); + } } }