Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 4660e8db4 -> b933939df


ATLAS-2996: Conditionally Prevent Notification Processing


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/b933939d
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/b933939d
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/b933939d

Branch: refs/heads/branch-0.8
Commit: b933939df1f901d13115045fba3db262f6fd353f
Parents: 4660e8d
Author: Ashutosh Mestry <ames...@hortonworks.com>
Authored: Mon Dec 17 14:31:23 2018 -0800
Committer: Ashutosh Mestry <ames...@hortonworks.com>
Committed: Mon Dec 17 21:13:36 2018 -0800

----------------------------------------------------------------------
 .../apache/atlas/notification/NotificationHookConsumer.java | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/b933939d/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
----------------------------------------------------------------------
diff --git 
a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
 
b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
index 165ea91..1b5872f 100644
--- 
a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
+++ 
b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java
@@ -107,6 +107,7 @@ public class NotificationHookConsumer implements Service, 
ActiveStateChangeHandl
     public static final String CONSUMER_RETRY_INTERVAL           = 
"atlas.notification.consumer.retry.interval";
     public static final String CONSUMER_MIN_RETRY_INTERVAL       = 
"atlas.notification.consumer.min.retry.interval";
     public static final String CONSUMER_MAX_RETRY_INTERVAL       = 
"atlas.notification.consumer.max.retry.interval";
+    public static final String CONSUMER_DISABLED                 = 
"atlas.notification.consumer.disabled";
     public static final int    SERVER_READY_WAIT_TIME_MS         = 1000;
 
     public static final String CONSUMER_SKIP_HIVE_COLUMN_LINEAGE_HIVE_20633    
              = 
"atlas.notification.consumer.skip.hive_column_lineage.hive-20633";
@@ -122,6 +123,7 @@ public class NotificationHookConsumer implements Service, 
ActiveStateChangeHandl
     private final int                    failedMsgCacheSize;
     private final boolean                skipHiveColumnLineageHive20633;
     private final int                    
skipHiveColumnLineageHive20633InputsThreshold;
+    private final boolean                consumerDisabled;
 
     @VisibleForTesting
     final int consumerRetryInterval;
@@ -155,6 +157,7 @@ public class NotificationHookConsumer implements Service, 
ActiveStateChangeHandl
 
         skipHiveColumnLineageHive20633                = 
applicationProperties.getBoolean(CONSUMER_SKIP_HIVE_COLUMN_LINEAGE_HIVE_20633, 
true);
         skipHiveColumnLineageHive20633InputsThreshold = 
applicationProperties.getInt(CONSUMER_SKIP_HIVE_COLUMN_LINEAGE_HIVE_20633_INPUTS_THRESHOLD,
 15); // skip if avg # of inputs is > 15
+        consumerDisabled                                                       
  = applicationProperties.getBoolean(CONSUMER_DISABLED, false);
 
         LOG.info("{}={}", CONSUMER_SKIP_HIVE_COLUMN_LINEAGE_HIVE_20633, 
skipHiveColumnLineageHive20633);
         LOG.info("{}={}", 
CONSUMER_SKIP_HIVE_COLUMN_LINEAGE_HIVE_20633_INPUTS_THRESHOLD, 
skipHiveColumnLineageHive20633InputsThreshold);
@@ -162,6 +165,12 @@ public class NotificationHookConsumer implements Service, 
ActiveStateChangeHandl
 
     @Override
     public void start() throws AtlasException {
+        if (consumerDisabled) {
+            LOG.info("Hook consumer stopped. No hook messages will be 
processed. " +
+                    "Set property '{}' to false to start consuming hook 
messages.", CONSUMER_DISABLED);
+            return;
+        }
+
         startInternal(applicationProperties, null);
     }
 

Reply via email to