From abf8a8c9947eabe0b0767c673b2f941e5dbe2399 Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Tue, 27 Nov 2018 16:30:10 +0530 Subject: [PATCH 1/6] Update SubscriptionManager.java --- .../cepheus/cep/SubscriptionManager.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java index 1e9db5d0..59f16eab 100644 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java @@ -258,6 +258,24 @@ private void subscribeProvider(Provider provider, SubscribeContext subscribeCont logger.warn("Error during subscription for {}", provider.getUrl(), throwable); }); } + + /** + * Unsubscribe from Provider of the configuration that is being deleted + * @param configuration the configuration that is being deleted + */ + public void unsubscribe(Configuration configuration){ + + List eventTypeIns = Collections.emptyList(); + eventTypeIns = configuration.getEventTypeIns(); + + for (EventTypeIn eventType : eventTypeIns) { + for (Provider provider : eventType.getProviders()) { + if (provider != null) { + unsubscribeProvider(provider); + } + } + } + } /** * Unsubscribe from a provider From 7ff76e48f593ede2d6fa6ae9c83be196ccdcd448 Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:26:30 +0530 Subject: [PATCH 2/6] Update AdminController.java --- .../com/orange/cepheus/cep/controller/AdminController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java index d4a8caa3..c0011a23 100755 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java @@ -144,6 +144,12 @@ public synchronized ResponseEntity removeConfiguration() throws P if (tenantFilter != null) { tenantFilter.removeTenant(configurationId); } + //Retrieve the configuration + final Configuration configuration = complexEventProcessor.getConfiguration(); + //Unsubscribe from Provider of the configuration + if (configuration != null) { + subscriptionManager.unsubscribe(configuration); + } // Reset the CEP complexEventProcessor.reset(); // Delete the persisted configuration From c22730b681735b3830790ddd56a8a74e65431baa Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:27:47 +0530 Subject: [PATCH 3/6] Update AdminController.java --- .../orange/cepheus/cep/controller/AdminController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java index c0011a23..26b2d40d 100755 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java @@ -144,11 +144,11 @@ public synchronized ResponseEntity removeConfiguration() throws P if (tenantFilter != null) { tenantFilter.removeTenant(configurationId); } - //Retrieve the configuration + // Retrieve the configuration final Configuration configuration = complexEventProcessor.getConfiguration(); - //Unsubscribe from Provider of the configuration - if (configuration != null) { - subscriptionManager.unsubscribe(configuration); + // Unsubscribe from Provider of the configuration + if (configuration != null) { + subscriptionManager.unsubscribe(configuration); } // Reset the CEP complexEventProcessor.reset(); From 48340bc83dc5f766a4659cef488adb45167ea1ea Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:31:25 +0530 Subject: [PATCH 4/6] Update SubscriptionManager.java --- .../orange/cepheus/cep/SubscriptionManager.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java index 59f16eab..ca85e373 100644 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/SubscriptionManager.java @@ -264,17 +264,15 @@ private void subscribeProvider(Provider provider, SubscribeContext subscribeCont * @param configuration the configuration that is being deleted */ public void unsubscribe(Configuration configuration){ - List eventTypeIns = Collections.emptyList(); eventTypeIns = configuration.getEventTypeIns(); - for (EventTypeIn eventType : eventTypeIns) { - for (Provider provider : eventType.getProviders()) { - if (provider != null) { - unsubscribeProvider(provider); - } - } - } + for (Provider provider : eventType.getProviders()) { + if (provider != null) { + unsubscribeProvider(provider); + } + } + } } /** From d259edd949422ce1534b59066845e284d830c934 Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:33:22 +0530 Subject: [PATCH 5/6] Update AdminController.java --- .../com/orange/cepheus/cep/controller/AdminController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java index 26b2d40d..4943089c 100755 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java @@ -144,9 +144,9 @@ public synchronized ResponseEntity removeConfiguration() throws P if (tenantFilter != null) { tenantFilter.removeTenant(configurationId); } - // Retrieve the configuration + //Retrieve the configuration final Configuration configuration = complexEventProcessor.getConfiguration(); - // Unsubscribe from Provider of the configuration + //Unsubscribe from Provider of the configuration if (configuration != null) { subscriptionManager.unsubscribe(configuration); } From 55ea451481400762108caf492f6e6a1d31a3cd50 Mon Sep 17 00:00:00 2001 From: Pooja Pathak <33315652+pooja1pathak@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:46:41 +0530 Subject: [PATCH 6/6] Update AdminController.java --- .../com/orange/cepheus/cep/controller/AdminController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java index 4943089c..7d76be59 100755 --- a/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java +++ b/cepheus-cep/src/main/java/com/orange/cepheus/cep/controller/AdminController.java @@ -144,9 +144,9 @@ public synchronized ResponseEntity removeConfiguration() throws P if (tenantFilter != null) { tenantFilter.removeTenant(configurationId); } - //Retrieve the configuration + // Retrieve the configuration final Configuration configuration = complexEventProcessor.getConfiguration(); - //Unsubscribe from Provider of the configuration + // Unsubscribe from Provider of the configuration if (configuration != null) { subscriptionManager.unsubscribe(configuration); }