hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raymond Lau <r...@ooyala.com>
Subject Re: Metastore Event Listeners
Date Tue, 29 Jul 2014 18:13:17 GMT
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 <rlau@ooyala.com> 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 |
> rlau@ooyala.com | (925) 395-3806
>



-- 
*Raymond Lau*
Software Engineer - Intern |
rlau@ooyala.com | (925) 395-3806

Mime
View raw message