Class JeroMQInstanceConnectionService
java.lang.Object
dev.getelements.elements.rt.remote.jeromq.JeroMQInstanceConnectionService
- All Implemented Interfaces:
InstanceConnectionService
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.getelements.elements.rt.remote.InstanceConnectionService
InstanceConnectionService.InstanceBinding, InstanceConnectionService.InstanceConnection
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets aList<InstanceConnectionService.InstanceConnection>
representing all active connections.Gets theInstanceId
for thisInstanceConnectionService
.Returns the local control address.long
jakarta.inject.Provider
<RemoteInvoker> org.zeromq.ZContext
openBinding
(NodeId nodeId) Gets anInstanceConnectionService.InstanceBinding
which a node can then use to receive incoming data.void
refresh()
Forces a refresh from the latest source of data immediately.void
setAsyncControlClientFactory
(AsyncControlClient.Factory asyncControlClientFactory) void
setBindAddress
(String bindAddress) void
setInstanceDiscoveryService
(InstanceDiscoveryService instanceDiscoveryService) void
setInstanceId
(InstanceId instanceId) void
setRefreshIntervalInSeconds
(long refreshIntervalInSeconds) void
setRemoteInvokerProvider
(jakarta.inject.Provider<RemoteInvoker> remoteInvokerProvider) void
setSecurityChain
(JeroMQSecurity securityChain) void
setzContext
(org.zeromq.ZContext zContext) void
start()
Starts the service.void
stop()
Stops the service.Adds aConsumer<InstanceConnectionService.InstanceConnection>
that will be called when a new instance has connected to thisInstanceConnectionService
.Adds aConsumer<InstanceConnectionService.InstanceConnection>
that will be called when a an instance has disconnected from thisInstanceConnectionService
.
-
Field Details
-
JEROMQ_CLUSTER_BIND_ADDRESS
- See Also:
-
JEROMQ_CONNECTION_SERVICE_REFRESH_INTERVAL_SECONDS
- See Also:
-
-
Constructor Details
-
JeroMQInstanceConnectionService
public JeroMQInstanceConnectionService()
-
-
Method Details
-
start
public void start()Description copied from interface:InstanceConnectionService
Starts the service.- Specified by:
start
in interfaceInstanceConnectionService
-
stop
public void stop()Description copied from interface:InstanceConnectionService
Stops the service.- Specified by:
stop
in interfaceInstanceConnectionService
-
refresh
public void refresh()Description copied from interface:InstanceConnectionService
Forces a refresh from the latest source of data immediately. This will ensure that newInstanceConnectionService.InstanceConnection
s are added and stale ones removed immediately. All necessary events will be driven as part of this call.- Specified by:
refresh
in interfaceInstanceConnectionService
-
openBinding
Description copied from interface:InstanceConnectionService
Gets anInstanceConnectionService.InstanceBinding
which a node can then use to receive incoming data. If a binding already exists for the suppliedNodeId
, then an exception will be thrown.- Specified by:
openBinding
in interfaceInstanceConnectionService
- Parameters:
nodeId
- theNodeId
for which the binding will be used.- Returns:
- the
InstanceConnectionService.InstanceBinding
-
getActiveConnections
Description copied from interface:InstanceConnectionService
Gets aList<InstanceConnectionService.InstanceConnection>
representing all active connections.- Specified by:
getActiveConnections
in interfaceInstanceConnectionService
- Returns:
- the list of all active
InstanceConnectionService.InstanceConnection
s
-
subscribeToConnect
public Subscription subscribeToConnect(Consumer<InstanceConnectionService.InstanceConnection> onConnect) Description copied from interface:InstanceConnectionService
Adds aConsumer<InstanceConnectionService.InstanceConnection>
that will be called when a new instance has connected to thisInstanceConnectionService
.- Specified by:
subscribeToConnect
in interfaceInstanceConnectionService
- Parameters:
onConnect
- theConsumer<InstanceConnectionService.InstanceConnection>
- Returns:
- a
Subscription
that can be cancled later.
-
subscribeToDisconnect
public Subscription subscribeToDisconnect(Consumer<InstanceConnectionService.InstanceConnection> onDisconnect) Description copied from interface:InstanceConnectionService
Adds aConsumer<InstanceConnectionService.InstanceConnection>
that will be called when a an instance has disconnected from thisInstanceConnectionService
.- Specified by:
subscribeToDisconnect
in interfaceInstanceConnectionService
- Parameters:
onDisconnect
- theConsumer<InstanceConnectionService.InstanceConnection>
- Returns:
- a
Subscription
that can be cancled later.
-
getLocalControlAddress
Description copied from interface:InstanceConnectionService
Returns the local control address. This is an address through which the a control client may be used to control the instance from within the local process space.- Specified by:
getLocalControlAddress
in interfaceInstanceConnectionService
- Returns:
- the local control address.
-
getInstanceId
Description copied from interface:InstanceConnectionService
Gets theInstanceId
for thisInstanceConnectionService
.- Specified by:
getInstanceId
in interfaceInstanceConnectionService
- Returns:
- the
InstanceId
-
setInstanceId
-
getzContext
public org.zeromq.ZContext getzContext() -
setzContext
@Inject public void setzContext(org.zeromq.ZContext zContext) -
getBindAddress
-
setBindAddress
@Inject public void setBindAddress(@Named("dev.getelements.elements.rt.remote.jeromq.bind.addr") String bindAddress) -
getRemoteInvokerProvider
-
setRemoteInvokerProvider
@Inject public void setRemoteInvokerProvider(jakarta.inject.Provider<RemoteInvoker> remoteInvokerProvider) -
getRefreshIntervalInSeconds
public long getRefreshIntervalInSeconds() -
setRefreshIntervalInSeconds
@Inject public void setRefreshIntervalInSeconds(@Named("dev.getelements.elements.rt.remote.jeromq.connection.service.refresh.interval.sec") long refreshIntervalInSeconds) -
getInstanceDiscoveryService
-
setInstanceDiscoveryService
-
getAsyncControlClientFactory
-
setAsyncControlClientFactory
@Inject public void setAsyncControlClientFactory(AsyncControlClient.Factory asyncControlClientFactory) -
getSecurityChain
-
setSecurityChain
-