use of com.google.cloud.pubsub.v1.SubscriberInterface in project micronaut-gcp by micronaut-projects.
the class DefaultSubscriberFactory method close.
@PreDestroy
@Override
public void close() throws Exception {
while (!subscribers.entrySet().isEmpty()) {
Iterator<Map.Entry<ProjectSubscriptionName, Subscriber>> it = subscribers.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<ProjectSubscriptionName, Subscriber> entry = it.next();
SubscriberInterface subscriber = entry.getValue();
try {
subscriber.stopAsync().awaitTerminated();
} catch (Exception e) {
logger.error("Failed stopping subscriber for " + entry.getKey(), e);
} finally {
it.remove();
}
}
}
}
Aggregations