Backend Development 3 min read

Apollo Configuration Change Notification Process and Long‑Polling Mechanism

The article explains Apollo’s client‑side long‑polling workflow, how the Config Service suspends requests with Spring DeferredResult, stores them in a cache, and notifies clients of configuration changes via database messages and background scanning, enabling immediate config refresh.

Cognitive Technology Team
Cognitive Technology Team
Cognitive Technology Team
Apollo Configuration Change Notification Process and Long‑Polling Mechanism

When an Apollo client starts, it launches an asynchronous thread that continuously sends an HTTP long‑polling request to the Config Service’s /notifications/v2 endpoint; the request times out after 90 seconds, longer than the server’s 60‑second long‑poll timeout.

The Config Service receives the request and, instead of replying immediately, suspends it using Spring’s DeferredResult , storing the DeferredResult in a local cache keyed by client information.

If no relevant configuration change occurs within 60 seconds, the service returns HTTP 304; otherwise, when a change is published, the Admin Service writes a notification message to the database, which the Config Service’s background scanner picks up.

The scanner retrieves the matching DeferredResult from the cache and invokes setResult , causing the long‑poll request to return the changed namespace; the client then immediately requests the latest configuration for that namespace.

private final Multimap
deferredResults =
      Multimaps.synchronizedSetMultimap(
          TreeMultimap.create(String.CASE_INSENSITIVE_ORDER, Ordering.natural()));
Backend DevelopmentConfiguration ManagementApollonotificationlong pollingSpring DeferredResult
Cognitive Technology Team
Written by

Cognitive Technology Team

Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.