Skip to content
Snippets Groups Projects
Commit c7b73409 authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Optimize infrastructure cost (GONRG-5736)

parent ce12f7d4
No related branches found
No related tags found
1 merge request!264Optimize infrastructure cost (GONRG-5736)
......@@ -77,28 +77,28 @@ public class OqmSubscriberManager {
@PostConstruct
void postConstruct() {
log.info("OqmSubscriberManager bean constructed. Provisioning STARTED");
log.debug("OqmSubscriberManager bean constructed. Provisioning STARTED.");
provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers();
provisionControlTopicsWithSubscriptionsAndSubscribersForAllTenantsBrokers();
log.info("OqmSubscriberManager bean constructed. Provisioning COMPLETED");
log.debug("OqmSubscriberManager bean constructed. Provisioning COMPLETED.");
}
@PreDestroy
void onPreDestroy() {
log.info("OqmSubscriberManager bean on pre-destroy: STARTED");
log.debug("OqmSubscriberManager bean on pre-destroy: STARTED.");
unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers();
log.info("OqmSubscriberManager bean on pre-destroy: COMPLETED");
log.debug("OqmSubscriberManager bean on pre-destroy: COMPLETED.");
}
void unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers() {
for (TenantInfo tenant : tenantInfoFactory.listTenantInfo()) {
String tenantId = tenant.getDataPartitionId();
log.info("* OqmSubscriberManager on pre-destroy for tenant {}:", tenantId);
log.debug("* OqmSubscriberManager on pre-destroy for tenant {}:", tenantId);
OqmSubscription subscriberControlTopicSubscriptionForTenant = driver.getSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant)).orElse(null);
if (subscriberControlTopicSubscriptionForTenant != null) {
log.info("* * OqmSubscriberManager on delete '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription DELETED.",
log.debug("* * OqmSubscriberManager on delete '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription DELETED.",
properties.getRegisterSubscriberControlTopicName(), subscriberControlTopicSubscriptionName, tenantId);
driver.deleteSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant));
}
......@@ -107,17 +107,17 @@ public class OqmSubscriberManager {
void provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers() {
for (TenantInfo tenantInfo : tenantInfoFactory.listTenantInfo()) {
log.info("* OqmSubscriberManager on provisioning tenant {}:", tenantInfo.getDataPartitionId());
log.debug("* OqmSubscriberManager on provisioning tenant {}:", tenantInfo.getDataPartitionId());
//For every Tenant Destination get "subscriberable" Subscriptions
for (OqmSubscription subscription : getSubscriberableSubscriptions(tenantInfo)) {
log.info("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}:", tenantInfo.getDataPartitionId(), subscription.getName());
log.debug("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}:", tenantInfo.getDataPartitionId(), subscription.getName());
//Register a Subscriber on every subscription
registerSubscriber(tenantInfo, subscription);
log.info("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}: Subscriber REGISTERED.", tenantInfo.getDataPartitionId(), subscription.getName());
log.debug("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}: Subscriber REGISTERED.", tenantInfo.getDataPartitionId(), subscription.getName());
}
log.info("* OqmSubscriberManager on provisioning tenant {}: COMPLETED.", tenantInfo.getDataPartitionId());
log.debug("* OqmSubscriberManager on provisioning tenant {}: COMPLETED.", tenantInfo.getDataPartitionId());
}
}
......@@ -127,19 +127,19 @@ public class OqmSubscriberManager {
String tenantId = tenant.getDataPartitionId();
log.info("* OqmSubscriberManager on check '{}' subscriber control topic existence at tenant's '{}' message broker", controlTopicName, tenantId);
log.debug("* OqmSubscriberManager on check '{}' subscriber control topic existence at tenant's '{}' message broker.", controlTopicName, tenantId);
OqmTopic subscriberControlTopic = driver.getTopic(controlTopicName, getDestination(tenant)).orElse(null);
boolean controlTopicForTenantJustCreated;
if (subscriberControlTopic != null) {
log.info("* * OqmSubscriberManager: '{}' subscriber control topic exists at tenant's '{}' message broker", controlTopicName, tenantId);
log.debug("* * OqmSubscriberManager: '{}' subscriber control topic exists at tenant's '{}' message broker.", controlTopicName, tenantId);
controlTopicForTenantJustCreated = false;
} else {
log.info("* * OqmSubscriberManager: '{}' subscriber control topic doesn't exist at tenant's '{}' message broker. Trying to create it:", controlTopicName, tenantId);
log.debug("* * OqmSubscriberManager: '{}' subscriber control topic doesn't exist at tenant's '{}' message broker. Trying to create it:", controlTopicName, tenantId);
driver.createAndGetTopic(controlTopicName, getDestination(tenant));
controlTopicForTenantJustCreated = true;
}
log.info("* * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker",
log.debug("* * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker.",
controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
OqmSubscription subscriberControlTopicSubscriptionForTenant = null;
......@@ -151,15 +151,15 @@ public class OqmSubscriberManager {
}
if (subscriberControlTopicSubscriptionForTenant != null) {
log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription CREATED.",
log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription CREATED.",
controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
} else {
subscriberControlTopicSubscriptionForTenant = driver.createAndGetSubscription(subscriptionRequest, getDestination(tenant));
log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription already EXISTS.",
log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription already EXISTS.",
controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
registerControlTopicSubscriber(tenant, subscriberControlTopicSubscriptionForTenant);
log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscriber REGISTERED.",
log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscriber REGISTERED.",
controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
}
......@@ -199,7 +199,7 @@ public class OqmSubscriberManager {
OqmSubscriber subscriber = OqmSubscriber.builder().subscription(subscription).messageReceiver(receiver).build();
driver.subscribe(subscriber, destination);
log.info("Just subscribed at topic {} subscription {} for tenant {}",
log.debug("Just subscribed at topic {} subscription {} for tenant {}.",
subscription.getTopics().get(0), subscription.getName(), tenantInfo.getDataPartitionId());
}
......@@ -228,7 +228,7 @@ public class OqmSubscriberManager {
OqmDestination destination = getDestination(tenantInfo);
driver.subscribe(subscriber, destination);
log.info("Just subscribed at topic {} subscription {} for tenant {}",
log.debug("Just subscribed at topic {} subscription {} for tenant {}.",
controlTopicSubscription.getTopics().get(0), controlTopicSubscription.getName(), tenantInfo.getDataPartitionId());
}
......
......@@ -71,7 +71,7 @@ public class OqmNotificationHandler {
.connectionTimeout(oqmConfigurationProperties.getWaitingTime())
.build();
HttpResponse response = httpClient.send(request);
log.debug("Sending out notification to endpoint: " + endpoint);
log.debug("Sending out notification to endpoint: {}.", endpoint);
return response;
}
}
\ No newline at end of file
......@@ -60,7 +60,7 @@ public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidat
return false;
}
} catch (Exception e) {
this.log.error("Error when validating google id token", e);
log.error("Error when validating google id token.", e);
return false;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment