Interface EndpointRegistry<K>

Type Parameters:
K - endpoint key
All Superinterfaces:
AutoCloseable, Map<K,Endpoint>, Service, StaticService

public interface EndpointRegistry<K> extends Map<K,Endpoint>, StaticService
Registry to cache endpoints in memory.

The registry contains two caches:

  • static - which keeps all the endpoints in the cache for the entire lifecycle
  • dynamic - which keeps the endpoints in a org.apache.camel.support.LRUCache and may evict endpoints which hasn't been requested recently
The static cache stores all the endpoints that are created as part of setting up and starting routes. The static cache has no upper limit.

The dynamic cache stores the endpoints that are created and used ad-hoc, such as from custom Java code that creates new endpoints etc. The dynamic cache has an upper limit, that by default is 1000 entries.

  • Method Details

    • staticSize

      int staticSize()
      Number of endpoints in the static registry.
    • dynamicSize

      int dynamicSize()
      Number of endpoints in the dynamic registry
    • getMaximumCacheSize

      int getMaximumCacheSize()
      Maximum number of entries to store in the dynamic registry
    • purge

      void purge()
      Purges the cache (removes endpoints from the dynamic cache)
    • isStatic

      boolean isStatic(String key)
      Whether the given endpoint is stored in the static cache
      Parameters:
      key - the endpoint key
      Returns:
      true if in static cache, false if not
    • isDynamic

      boolean isDynamic(String key)
      Whether the given endpoint is stored in the dynamic cache
      Parameters:
      key - the endpoint key
      Returns:
      true if in dynamic cache, false if not
    • containsKey

      boolean containsKey(Object key)
      Whether the given endpoint is stored in the registry
      Specified by:
      containsKey in interface Map<K,Endpoint>
      Parameters:
      key - the endpoint key
      Returns:
      true if present, false if not
    • cleanUp

      void cleanUp()
      Cleanup the cache (purging stale entries)
    • getReadOnlyValues

      Collection<Endpoint> getReadOnlyValues()
      Gets a read-only collection of the endpoints currently in the registry.
    • getReadOnlyMap

      Map<String,Endpoint> getReadOnlyMap()
      Gets a read-only map of the endpoints currently in the registry.