All Products
Search
Document Center

Microservices Engine:Conditional registration for graceful start (public preview)

Last Updated:Mar 11, 2026

Fixed-delay registration works for most microservices, but it falls short when initialization time varies -- too short a delay causes premature traffic, and too long a delay wastes deployment time. Conditional registration lets your application signal when it is ready, so the Microservices Engine (MSE) agent registers the service at exactly the right moment.

Note

This feature is in public preview and requires MSE agent version 4.6.0 or later. To specify an agent version, see Specify an MSE agent version.

When to use conditional registration

Use conditional registration instead of fixed-delay registration when your application:

  • Loads caches, precomputes indexes, or performs other asynchronous initialization with unpredictable duration.

  • Depends on local resource readiness that cannot be expressed as a simple time delay.

  • Requires precise control over when the service starts accepting microservice traffic.

If your initialization timing is predictable, fixed-delay registration is simpler and sufficient. If you are new to the graceful start and shutdown features of MSE, use the fixed-delay registration solution first. It covers most typical application scenarios. Conditional registration requires a code change in your application -- evaluate this trade-off before proceeding.

How it works

The MSE agent polls a Java system property that you define in the startup parameters or environment variables. Your application sets this property to true after it completes its custom initialization logic. When the agent detects the property value, it triggers microservice registration.

Before the condition is met, the service is not registered and receives no traffic.

Startup flow with a Kubernetes readiness probe

When conditional registration is combined with a Kubernetes readiness probe, the startup sequence is:

PhaseWhat happens
1. Pod startsThe container starts running.
2. Application initializesBusiness logic runs (cache warming, data preloading, etc.).
3. Condition is setApplication code sets the system property to true.
4. MSE agent registers the serviceThe agent detects the condition and initiates microservice registration.
5. Service accepts trafficMicroservice registration succeeds and the service starts handling requests.
6. Readiness probe passesThe Kubernetes readiness probe at port 55199/readiness returns healthy.
7. Pod becomes ReadyKubernetes marks the pod as Ready and routes external traffic to it.

Prerequisites

Before you begin, make sure that you have:

Declare the condition key

Add the following configuration to your application's startup parameters or environment variables to declare the system property key used as the registration condition.

Format:

mse_lossless_register_condition_on_system_property_true="<your-condition-key>"

Example:

# Use PRODUCT_PRELOAD_COMPLETED as the registration condition key
mse_lossless_register_condition_on_system_property_true="PRODUCT_PRELOAD_COMPLETED"

Replace <your-condition-key> with a descriptive name that reflects your initialization logic.

Set the condition in your application code

After all initialization tasks are complete, call System.setProperty to set the condition key to true. The MSE agent detects this change and registers the service.

In the following example, a product cache loads asynchronously. After the cache is ready, the code sets the system property to signal readiness:

@Component
public class HotProductInitComponent {
    public ScheduledExecutorService executor = Executors.newScheduledThreadPool(
            1,
            new NameThreadFactory("product-preload-pool"));

    @Value("${demo.product.init.delay.seconds:3}")
    public long initDelaySeconds;

    public void asyncLoadPoductDataIntoCache() {
        executor.schedule(() -> {
            // ... load product data into cache ...

            // Signal that initialization is complete.
            // The MSE agent detects this and registers the service.
            System.setProperty("PRODUCT_PRELOAD_COMPLETED", "true");

        }, initDelaySeconds, TimeUnit.SECONDS);
    }
}

Interaction with other MSE features

TopicDetail
Readiness probe compatibilityConditional registration works with the MSE readiness probe at the 55199/readiness endpoint.
No separate graceful start toggleAfter you set mse_lossless_register_condition_on_system_property_true in startup parameters or environment variables, conditional registration is enabled automatically. You do not need to enable a separate graceful start option.
Delayed registration not requiredAfter you enable conditional registration, you do not need to configure delayed registration for graceful start.