Class ServiceRegistry

java.lang.Object
org.nustaq.kontraktor.Actors
org.nustaq.kontraktor.Actor<ServiceRegistry>
org.nustaq.kontraktor.services.ServiceRegistry
All Implemented Interfaces:
java.io.Serializable, java.util.concurrent.Executor, org.nustaq.kontraktor.monitoring.Monitorable
Direct Known Subclasses:
DynDataServiceRegistry

public class ServiceRegistry
extends org.nustaq.kontraktor.Actor<ServiceRegistry>
Created by ruedi on 11.08.2015. a simple service registry. Services can be registered by name. They are expected to send cyclical heartbeats. By registering a listener (callback) remote services can listen to availability/unavailability of services Rationale: in cluster of services managing connectivity gets complex quickly. In order to simplify this, services are given a single point of contact: the service registry (serviceRegistry). They register themself and obtain address and availability from the central registry. Note: Downside is, this is a SPOF.
See Also:
Serialized Form
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  ServiceRegistry.RestApi  
    static class  ServiceRegistry.StatusEntry  

    Nested classes/interfaces inherited from class org.nustaq.kontraktor.Actor

    org.nustaq.kontraktor.Actor.ActorReport
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String AVAILABLE  
    protected ClusterCfg config  
    static java.lang.String CONFIGUPDATE  
    protected java.util.List<org.nustaq.kontraktor.Callback> listeners  
    static RegistryArgs options  
    static java.lang.String SERVICEDUMP  
    protected java.util.HashMap<java.lang.String,​java.util.List<org.nustaq.kontraktor.remoting.base.ServiceDescription>> services  
    protected java.util.Map<java.lang.String,​ServiceRegistry.StatusEntry> statusMap  
    static java.lang.String TIMEOUT  

    Fields inherited from class org.nustaq.kontraktor.Actor

    __cbQueue, __clientConnection, __connections, __currentDispatcher, __mailbox, __mailboxCapacity, __mbCapacity, __publishTarget, __remoteId, __scheduler, __self, __stopped, __ticketMachine, connection, sender, userData, zzRoutingGCEnabled, zzServerMsgCallback

    Fields inherited from class org.nustaq.kontraktor.Actors

    CONT, DEFAULT_TIMOUT, defaultScheduler, delayedCalls, exec, instance, MAX_EXTERNAL_THREADS_POOL_SIZE, version
  • Constructor Summary

    Constructors 
    Constructor Description
    ServiceRegistry()  
  • Method Summary

    Modifier and Type Method Description
    org.nustaq.kontraktor.IPromise balanceDynShards()  
    protected void broadcastAvailable​(org.nustaq.kontraktor.remoting.base.ServiceDescription desc)  
    protected void broadCastTimeOut​(org.nustaq.kontraktor.remoting.base.ServiceDescription desc)  
    void checkTimeout()  
    org.nustaq.kontraktor.IPromise<ClusterCfg> getConfig()  
    protected org.nustaq.kontraktor.remoting.base.ServiceDescription getService​(java.lang.String name)  
    protected java.util.List<org.nustaq.kontraktor.remoting.base.ServiceDescription> getServiceList​(java.lang.String serviceName)  
    org.nustaq.kontraktor.IPromise<java.util.Map<java.lang.String,​org.nustaq.kontraktor.remoting.base.ServiceDescription>> getServiceMap()  
    org.nustaq.kontraktor.IPromise<java.util.List<ServiceRegistry.StatusEntry>> getStati()  
    void init​(ClusterCfg cfg)  
    static void main​(java.lang.String[] args)  
    static ServiceArgs parseCommandLine​(java.lang.String[] args, java.lang.String[] concatArgs, ServiceArgs options)  
    static ServiceArgs parseCommandLine​(java.lang.String[] args, ServiceArgs options)  
    void receiveHeartbeat​(java.lang.String serviceName, java.lang.String uniqueKey)  
    void receiveHeartbeatWithStatus​(java.lang.String serviceName, java.lang.String uniqueKey, java.io.Serializable status)  
    void registerService​(org.nustaq.kontraktor.remoting.base.ServiceDescription desc)  
    org.nustaq.kontraktor.IPromise releaseDynShard​(java.lang.String name)  
    protected void removeStatus​(java.lang.String key)  
    void serviceDumper()  
    static ServiceRegistry start​(java.lang.String[] args)  
    static ServiceRegistry start​(RegistryArgs options)  
    static ServiceRegistry start​(RegistryArgs _options, ClusterCfg cfg, java.lang.Class<? extends ServiceRegistry> clazz)  
    static void start​(SingleProcessRLClusterArgs options, ClusterCfg cfg)  
    void subscribe​(org.nustaq.kontraktor.Callback<org.nustaq.kontraktor.util.Pair<java.lang.String,​org.nustaq.kontraktor.remoting.base.ServiceDescription>> cb)  
    protected void updateStatus​(long now, org.nustaq.kontraktor.remoting.base.ServiceDescription td, java.lang.String key, java.io.Serializable status)  

    Methods inherited from class org.nustaq.kontraktor.Actor

    __addDeadLetter, __addRemoteConnection, __addStopHandler, __dispatchRemoteCall, __enqueueCall, __getCachedMethod, __removeRemoteConnection, __stop, __stopImpl, __submit, ask, askMsg, asyncstop, checkThread, close, closeCurrentClient, current, cyclic, debounce, delayed, execInThreadPool, execute, getActor, getActorRef, getCallbackSize, getConnections, getCurrentDispatcher, getFactory, getMailboxSize, getQSizes, getReport, getScheduler, getSubMonitorables, getUntypedRef, hasStopped, inside, inThread, isCallbackQPressured, isEmpty, isMailboxPressured, isProxy, isPublished, isRemote, isStopped, ping, router$clientPing, self, serialOn, setServerMsgCallback, stop, stopSafeClose, tell, tellMsg, unpublish, zzkrouterLostClient, zzRoutingRefGC

    Methods inherited from class org.nustaq.kontraktor.Actors

    AddDeadLetter, all, all, all, allMapped, AsActor, AsActor, AsActor, AsActor, AsUntypedActor, awaitAll, awaitAll, awaitAll, awaitAll, complete, complete, DeadLetters, flow, InThread, isComplete, isCont, isError, isErrorOrComplete, isResult, isTimeout, kYield, kYield, promise, race, race, reject, resolve, resolve, stream, SubmitDelayed, yieldCallbacks

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait