Figured out my problem. I didn't add the jar to the classpath properly, was trying to reference it locally instead of on HDFS.
On Mon, Jul 28, 2014 at 7:23 PM, Raymond Lau <[email protected]> wrote: > Hey guys, I'm having some trouble getting my Metastore Event Listener to > do anything, none of my print statements are occuring. What am I missing? > I added the jar in the classpath and i'm pretty sure that it's getting > loaded. Nothing is showing up in the hive CLI when i create partition on > an external table via "ALTER TABLE table ADD PARTITION > (partitionkey='blah') LOCATION '/path/to/hdfs/file' " > > In my hive-site.xml, I have the event listener setting as: > > <property> > <name>hive.metastore.event.listeners</name> > <value>company.analytics.MyNotificationListener</value> > </property> > > I checked that it's loading via "set;" and it > shows: hive.metastore.event.listeners=company.analytics.MyNotificationListener > > And here's my code: > > package company.analytics > > import org.apache.hadoop.conf.Configuration; > import org.apache.hadoop.hive.metastore.MetaStoreEventListener; > import org.apache.hadoop.hive.metastore.api.MetaException; > import org.apache.hadoop.hive.metastore.events.AddPartitionEvent; > import org.apache.hadoop.hive.metastore.events.AlterTableEvent; > > public class MyNotificationListener extends MetaStoreEventListener { > > public KafkaNotificationListener(final Configuration conf) { > super(conf); > System.out.println("Created Kafka Notification Listener"); > } > > @Override > public void onAddPartition(AddPartitionEvent partitionEvent) throws > MetaException { > System.out.println("Created partition " + > partitionEvent.getPartition().getTableName()); > } > > @Override > public void onAlterTable(AlterTableEvent alterTableEvent) throws > MetaException { > System.out.println("ALTERED TABLE"); > } > > } > > Thanks in advance. > > -- > *Raymond Lau* > Software Engineer - Intern | > [email protected] | (925) 395-3806 > -- *Raymond Lau* Software Engineer - Intern | [email protected] | (925) 395-3806
