Commit 86ca682e authored by Nikhil Singh[MicroSoft]'s avatar Nikhil Singh[MicroSoft]
Browse files

Commit 15 Contents:

1-Config Changes
2-Subscription Management Fixes
parent b61b6840
Pipeline #52640 failed with stages
in 48 seconds
......@@ -37,7 +37,7 @@ public class Application {
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(new Class[]{Application.class}, args);
// Subscribe To Record changed event for Message Bus Notification Processing
// Subscribe To Notification Event for Message Bus Notification Processing
AzureBootstrapConfig azureBootstrapConfig = context.getBean(AzureBootstrapConfig.class);
if (Boolean.parseBoolean(azureBootstrapConfig.getServiceBusEnabled())) {
ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
......
......@@ -5,6 +5,7 @@ import com.microsoft.azure.servicebus.SubscriptionClient;
import com.microsoft.azure.servicebus.primitives.ServiceBusException;
import org.opengroup.osdu.azure.cosmosdb.CosmosStore;
import org.opengroup.osdu.azure.partition.PartitionServiceClient;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.model.notification.Subscription;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.core.common.notification.ISubscriptionFactory;
......@@ -73,22 +74,21 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
updateCurrentTopicSubscriptions(partition, subscription.getTopic(), subscription.getNotificationId());
} catch (InterruptedException | ServiceBusException e) {
LOGGER.error("Error while creating or registering subscription client {}", e.getMessage(), e);
} catch (Exception e) {
LOGGER.error("Error while creating or registering subscription client {}", e.getMessage(), e);
}
} else {
updateCurrentTopicSubscriptions(partition, subscription.getTopic(), subscription.getNotificationId());
}
}
} catch (AppException e) {
LOGGER.error("Error creating Cosmos Client {}", e.getMessage(), e);
} catch (Exception e) {
LOGGER.error("An exception occurred while subscribing to Notification Event : ", e);
} finally {
// Deletes the old subscriptions for next run
this.existingTopicSubscriptions.clear();
this.existingTopicSubscriptions.putAll(this.currentTopicSubscriptions);
this.currentTopicSubscriptions.clear();
}
}
// Deletes the old subscriptions for next run
this.existingTopicSubscriptions.clear();
this.existingTopicSubscriptions.putAll(this.currentTopicSubscriptions);
this.currentTopicSubscriptions.clear();
}
private boolean checkIfNewTopicSubscription(String partition, String sbTopicName, String subscriptionName) {
......
......@@ -32,12 +32,12 @@ public class AzureBootstrapConfig {
@Value("${max-lock-renew}")
private String maxLockRenewDurationInSeconds;
@Value("${initial_thread_delay_seconds}")
@Value("${initial-thread-delay}")
private String initialThreadDelayInSeconds;
@Value("${thread_delay_seconds}")
@Value("${thread-delay}")
private String threadDelayInSeconds;
@Value("${service_bus_enabled}")
@Value("${service-bus-enabled}")
private String ServiceBusEnabled;
}
......@@ -72,4 +72,4 @@ initial-thread-delay=${initial_thread_delay_seconds}
thread-delay=${thread_delay_seconds}
# Specifies if Service Bus is enabled
service_bus_enabled=true;
service-bus-enabled=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment