-
Notifications
You must be signed in to change notification settings - Fork 30
io microsphere spring cloud client service registry InMemoryServiceRegistry
Type: Class | Module: microsphere-spring-cloud-commons | Package: io.microsphere.spring.cloud.client.service.registry | Since: 1.0.0
In-Memory ServiceRegistry
public class InMemoryServiceRegistry implements ServiceRegistryAuthor: Mercy
-
Introduced in:
1.0.0 -
Current Project Version:
0.2.18-SNAPSHOT
This component is tested and compatible with the following Java versions:
| Java Version | Status |
|---|---|
| Java 17 | ✅ Compatible |
| Java 21 | ✅ Compatible |
| Java 25 | ✅ Compatible |
InMemoryServiceRegistry registry = new InMemoryServiceRegistry();
Registration registration = createRegistration();
registry.register(registration);InMemoryServiceRegistry registry = new InMemoryServiceRegistry();
Registration registration = createRegistration();
registry.register(registration);
registry.deregister(registration);InMemoryServiceRegistry registry = new InMemoryServiceRegistry();
registry.register(registration);
registry.close();InMemoryServiceRegistry registry = new InMemoryServiceRegistry();
registry.register(registration);
registry.setStatus(registration, "UP");InMemoryServiceRegistry registry = new InMemoryServiceRegistry();
registry.register(registration);
registry.setStatus(registration, "UP");
Object status = registry.getStatus(registration); // "UP"Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.microsphere-projects</groupId>
<artifactId>microsphere-spring-cloud-commons</artifactId>
<version>${microsphere-spring-cloud.version}</version>
</dependency>Tip: Use the BOM (
microsphere-spring-cloud-dependencies) for consistent version management. See the Getting Started guide.
import io.microsphere.spring.cloud.client.service.registry.InMemoryServiceRegistry;| Method | Description |
|---|---|
register |
Registers the given Registration instance in the in-memory storage, |
deregister |
Removes the given Registration instance from the in-memory storage. |
close |
Closes this registry by clearing all stored Registration instances. |
setStatus |
Sets the status of the given Registration by storing it in |
getStatus |
Retrieves the status of the given Registration from its metadata. |
public void register(Registration registration)Registers the given Registration instance in the in-memory storage,
keyed by its instance ID.
Example Usage:
`InMemoryServiceRegistry registry = new InMemoryServiceRegistry(); Registration registration = createRegistration(); registry.register(registration); `
public void deregister(Registration registration)Removes the given Registration instance from the in-memory storage.
Example Usage:
`InMemoryServiceRegistry registry = new InMemoryServiceRegistry(); Registration registration = createRegistration(); registry.register(registration); registry.deregister(registration); `
public void close()Closes this registry by clearing all stored Registration instances.
Example Usage:
`InMemoryServiceRegistry registry = new InMemoryServiceRegistry(); registry.register(registration); registry.close(); `
public void setStatus(Registration registration, String status)Sets the status of the given Registration by storing it in
the registration's metadata under the _status_ key.
Example Usage:
`InMemoryServiceRegistry registry = new InMemoryServiceRegistry(); registry.register(registration); registry.setStatus(registration, "UP"); `
public Object getStatus(Registration registration)Retrieves the status of the given Registration from its metadata.
Example Usage:
`InMemoryServiceRegistry registry = new InMemoryServiceRegistry(); registry.register(registration); registry.setStatus(registration, "UP"); Object status = registry.getStatus(registration); // "UP" `
This documentation was auto-generated from the source code of microsphere-spring-cloud.
spring-cloud-commons
- AbstractServiceRegistrationEndpoint
- CommonsPropertyConstants
- ConditionalOnAutoServiceRegistrationAvailable
- ConditionalOnAutoServiceRegistrationEnabled
- ConditionalOnBlockingDiscoveryAvailable
- ConditionalOnFeaturesAvailable
- ConditionalOnFeaturesEnabled
- ConditionalOnLoadBalancerEnabled
- ConditionalOnMultipleRegistrationEnabled
- ConditionalOnReactiveDiscoveryAvailable
- ConditionalOnUtilEnabled
- ConfigurationPropertyHasFeaturesAutoConfiguration
- DefaultRegistration
- DiscoveryClientAutoConfiguration
- DiscoveryClientConstants
- DiscoveryUtils
- EventPublishingRegistrationAspect
- FaultTolerancePropertyConstants
- InMemoryServiceRegistry
- InstanceConstants
- LoadBalancerUtils
- MultipleAutoServiceRegistration
- MultipleRegistration
- MultipleServiceRegistry
- ReactiveDiscoveryClientAdapter
- ReactiveDiscoveryClientAutoConfiguration
- RegistrationCustomizer
- RegistrationDeregisteredEvent
- RegistrationEvent
- RegistrationMetaData
- RegistrationPreDeregisteredEvent
- RegistrationPreRegisteredEvent
- RegistrationRegisteredEvent
- ServiceDeregistrationEndpoint
- ServiceInstanceUtils
- ServiceInstancesChangedEvent
- ServiceRegistrationEndpoint
- ServiceRegistrationEndpointAutoConfiguration
- ServiceRegistryAutoConfiguration
- SimpleAutoServiceRegistration
- SimpleAutoServiceRegistrationAutoConfiguration
- SimpleServiceRegistry
- SpecificationAutoConfiguration
- SpecificationBeanPostProcessor
- SpecificationCustomizer
- SpringCloudPropertyConstants
- TomcatDynamicConfigurationListener
- TomcatFaultToleranceAutoConfiguration
- UnionDiscoveryClient
- WebFluxServiceRegistryAutoConfiguration
- WebMvcServiceRegistryAutoConfiguration
- WebServiceRegistryAutoConfiguration
- WeightedRoundRobin
spring-cloud-openfeign
- AutoRefreshCapability
- AutoRefreshCapabilityCustomizer
- CompositedRequestInterceptor
- DecoratedContract
- DecoratedDecoder
- DecoratedEncoder
- DecoratedErrorDecoder
- DecoratedFeignComponent
- DecoratedQueryMapEncoder
- DecoratedRetryer
- EnableFeignAutoRefresh
- FeignAutoConfiguration
- FeignClientAutoRefreshAutoConfiguration
- FeignClientConfigurationChangedListener
- FeignComponentRegistry
- NoOpRequestInterceptor
- Refreshable