Package org.nustaq.kontraktor.services
Class ServiceRegistry
java.lang.Object
org.nustaq.kontraktor.Actors
org.nustaq.kontraktor.Actor<ServiceRegistry>
org.nustaq.kontraktor.services.ServiceRegistry
- All Implemented Interfaces:
Serializable,Executor,org.nustaq.kontraktor.monitoring.Monitorable
- Direct Known Subclasses:
DynDataServiceRegistry
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from class org.nustaq.kontraktor.Actor
org.nustaq.kontraktor.Actor.ActorReport -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected ClusterCfgstatic final Stringprotected List<org.nustaq.kontraktor.Callback>static RegistryArgsstatic final Stringprotected Map<String,ServiceRegistry.StatusEntry> static final StringFields inherited from class org.nustaq.kontraktor.Actor
__cbQueue, __clientConnection, __connections, __currentDispatcher, __mailbox, __mailboxCapacity, __mbCapacity, __publishTarget, __remoteId, __scheduler, __self, __stopped, __ticketMachine, connection, sender, userData, zzRoutingGCEnabled, zzServerMsgCallbackFields inherited from class org.nustaq.kontraktor.Actors
CONT, DEFAULT_TIMOUT, defaultScheduler, delayedCalls, exec, instance, MAX_EXTERNAL_THREADS_POOL_SIZE, version -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.nustaq.kontraktor.IPromiseonly valid on DynData cluster, rebalance data loadprotected voidbroadcastAvailable(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) protected voidbroadCastTimeOut(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) voidorg.nustaq.kontraktor.IPromise<org.nustaq.reallive.server.dynamic.DynClusterDistribution>only valid on DynData cluster, get distribution as assumed by registryorg.nustaq.kontraktor.IPromise<ClusterCfg>org.nustaq.kontraktor.IPromise<org.nustaq.reallive.server.dynamic.DynClusterDistribution>only valid on DynData cluster, get distribution as reported by datanodesConsumer<io.undertow.server.HttpServerExchange>Function<io.undertow.util.HeaderMap,org.nustaq.kontraktor.IPromise> protected org.nustaq.kontraktor.remoting.base.ServiceDescriptiongetService(String name) protected List<org.nustaq.kontraktor.remoting.base.ServiceDescription>getServiceList(String serviceName) org.nustaq.kontraktor.IPromise<List<ServiceRegistry.StatusEntry>>getStati()voidinit(ClusterCfg cfg) org.nustaq.kontraktor.IPromise<Boolean>static voidstatic <T extends ServiceArgs>
TparseCommandLine(String[] args, String[] concatArgs, T options) voidreceiveHeartbeat(String serviceName, String uniqueKey) voidreceiveHeartbeatWithStatus(String serviceName, String uniqueKey, Serializable status) voidregisterService(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) org.nustaq.kontraktor.IPromisereleaseDynShard(String name) drop node, remove all data !!protected voidremoveStatus(String key) voidsendServiceBroadcast(String messageId, Serializable message) voidstatic ServiceRegistrystatic ServiceRegistrystart(RegistryArgs options) static ServiceRegistrystart(RegistryArgs _options, ClusterCfg cfg, Class<? extends ServiceRegistry> clazz) static voidstart(SingleProcessRLClusterArgs options, ClusterCfg cfg) voidsubscribe(org.nustaq.kontraktor.Callback<org.nustaq.kontraktor.util.Pair<String, org.nustaq.kontraktor.remoting.base.ServiceDescription>> cb) protected voidupdateStatus(long now, org.nustaq.kontraktor.remoting.base.ServiceDescription td, String key, 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, zzRoutingRefGCMethods 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
-
Field Details
-
CONFIGUPDATE
- See Also:
-
SERVICEDUMP
- See Also:
-
AVAILABLE
- See Also:
-
TIMEOUT
- See Also:
-
services
-
statusMap
-
listeners
-
config
-
options
-
-
Constructor Details
-
ServiceRegistry
public ServiceRegistry()
-
-
Method Details
-
init
-
serviceDumper
public void serviceDumper() -
registerService
public void registerService(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) -
getServiceMap
-
getService
-
subscribe
public void subscribe(org.nustaq.kontraktor.Callback<org.nustaq.kontraktor.util.Pair<String, org.nustaq.kontraktor.remoting.base.ServiceDescription>> cb) -
broadcastAvailable
protected void broadcastAvailable(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) -
broadCastTimeOut
protected void broadCastTimeOut(org.nustaq.kontraktor.remoting.base.ServiceDescription desc) -
sendServiceBroadcast
-
getConfig
-
receiveHeartbeat
-
receiveHeartbeatWithStatus
-
removeStatus
-
updateStatus
protected void updateStatus(long now, org.nustaq.kontraktor.remoting.base.ServiceDescription td, String key, Serializable status) -
checkTimeout
public void checkTimeout() -
getServiceList
-
parseCommandLine
public static <T extends ServiceArgs> T parseCommandLine(String[] args, String[] concatArgs, T options) -
getDynDataDistribution
public org.nustaq.kontraktor.IPromise<org.nustaq.reallive.server.dynamic.DynClusterDistribution> getDynDataDistribution()only valid on DynData cluster, get distribution as reported by datanodes- Returns:
-
getActiveDynDataDistribution
public org.nustaq.kontraktor.IPromise<org.nustaq.reallive.server.dynamic.DynClusterDistribution> getActiveDynDataDistribution()only valid on DynData cluster, get distribution as assumed by registry- Returns:
-
balanceDynShards
public org.nustaq.kontraktor.IPromise balanceDynShards()only valid on DynData cluster, rebalance data load- Returns:
-
releaseDynShard
drop node, remove all data !!not yet implemented!!- Parameters:
name-- Returns:
-
getStati
-
main
-
start
-
start
-
start
-
start
public static ServiceRegistry start(RegistryArgs _options, ClusterCfg cfg, Class<? extends ServiceRegistry> clazz) -
isDynamic
-
getPrepareResponse
-
getReqAuth
-