From 7b679e42741a07c2a92fec83de2db50a623ca0be Mon Sep 17 00:00:00 2001 From: Chiran Fernando Date: Tue, 28 May 2019 12:09:05 +0530 Subject: [PATCH] Add null check during pause and resume --- .../extension/io/nats/source/NATSSource.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/component/src/main/java/io/siddhi/extension/io/nats/source/NATSSource.java b/component/src/main/java/io/siddhi/extension/io/nats/source/NATSSource.java index 6eaaac3..9514dba 100644 --- a/component/src/main/java/io/siddhi/extension/io/nats/source/NATSSource.java +++ b/component/src/main/java/io/siddhi/extension/io/nats/source/NATSSource.java @@ -213,12 +213,22 @@ public void destroy() { @Override public void pause() { - natsMessageProcessor.pause(); + if (natsMessageProcessor != null) { + natsMessageProcessor.pause(); + if (log.isDebugEnabled()) { + log.debug("Nats source paused for destination: " + destination); + } + } } @Override public void resume() { - natsMessageProcessor.resume(); + if (natsMessageProcessor != null) { + natsMessageProcessor.resume(); + if (log.isDebugEnabled()) { + log.debug("Nats source resumed for destination: " + destination); + } + } } private void subscribe(NATSSourceState natsSourceState) {