@Override
  public void onAlterPartition(AlterPartitionEvent ape) throws MetaException {
    if (ape.getStatus()) {
      Partition before = ape.getOldPartition();
      Partition after = ape.getNewPartition();

      String topicName = getTopicName(ape.getTable());
      send(messageFactory.buildAlterPartitionMessage(ape.getTable(),before, after,
              ape.getWriteId()), topicName);
    }
  }
Create message bus connection and session in constructor.
hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/NotificationListener.java