Interface DiscoveryCustomMessage
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
DiscoveryServerOnlyCustomMessage,SnapshotDiscoveryMessage
- All Known Implementing Classes:
AbstractContinuousMessage,CacheAffinityChangeMessage,CacheStatisticsClearMessage,CacheStatisticsModeChangeMessage,ChangeGlobalStateFinishMessage,ChangeGlobalStateMessage,ClientCacheChangeDiscoveryMessage,ClientCacheChangeDummyDiscoveryMessage,DynamicCacheChangeBatch,DynamicCacheChangeFailureMessage,FullMessage,InitMessage,MappingAcceptedMessage,MappingProposedMessage,MetadataRemoveAcceptedMessage,MetadataRemoveProposedMessage,MetadataUpdateAcceptedMessage,MetadataUpdateProposedMessage,SchemaAbstractDiscoveryMessage,SchemaFinishDiscoveryMessage,SchemaProposeDiscoveryMessage,ServiceChangeBatchRequest,ServiceClusterDeploymentResultBatch,StartRoutineAckDiscoveryMessage,StartRoutineDiscoveryMessage,StartRoutineDiscoveryMessageV2,StopRoutineAckDiscoveryMessage,StopRoutineDiscoveryMessage,TcpConnectionRequestDiscoveryMessage,TxTimeoutOnPartitionMapExchangeChangeMessage,UserAcceptedMessage,UserProposedMessage,WalStateAbstractMessage,WalStateFinishMessage,WalStateProposeMessage
public interface DiscoveryCustomMessage extends Serializable
DiscoveryCustomMessage messages are handled by discovery protocol which provides some guarantees around them. When some node sends DiscoveryCustomMessage withGridDiscoveryManager.sendCustomEvent(DiscoveryCustomMessage)call, message firstly goes to current coordinator, is verified there and after that gets sent to the cluster. Only after verification it is delivered to listeners on all nodes starting from coordinator. To register a listenerGridDiscoveryManager.setCustomEventListener(Class, CustomEventListener)method is used. Discovery protocol guarantees include:- All discovery messages are observed by all nodes in exactly the same order, it is guaranteed by handling them in single-threaded mode.
-
New server node joining process in default implementation involves two passes of different messages across the cluster:
TcpDiscoveryNodeAddedMessageandTcpDiscoveryNodeAddFinishedMessagemessages. It is guaranteed that all discovery messages observed by coordinator in between these two messages are reordered and guaranteed to be delivered to newly joined node.
-
Guarantee #2 doesn't encompass DiscoveryCustomMessages created automatically on
ackMessage()method call. If there were messages of this type in between TcpDiscoveryNodeAddedMessage and TcpDiscoveryNodeAddFinishedMessage messages, they won't be delivered to new joiner node. - There is no guarantee for a given DiscoveryCustomMessage to be delivered only once. It is possible that because of node failure antecedent node will resend messages it thinks were not sent by failed node. Duplicate messages are not filtered out on receiver side.
- DiscoveryCustomMessages are delivered to client nodes in asynchronous fashion as clients don't participate in the cluster ring.
- Any blocking operations like obtaining locks or doing I/O must be avoided in message handlers as they may lead to deadlocks and cluster failures.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @Nullable DiscoveryCustomMessageackMessage()Called when custom message has been handled by all nodes.DiscoCachecreateDiscoCache(GridDiscoveryManager mgr, AffinityTopologyVersion topVer, DiscoCache discoCache)Creates new discovery cache if message caused topology version change.IgniteUuidid()booleanisMutable()default booleanstopProcess()
-
-
-
Method Detail
-
id
IgniteUuid id()
- Returns:
- Unique custom message ID.
-
ackMessage
@Nullable @Nullable DiscoveryCustomMessage ackMessage()
Called when custom message has been handled by all nodes.- Returns:
- Ack message or
nullif ack is not required.
-
isMutable
boolean isMutable()
- Returns:
Trueif message can be modified during listener notification. Changes will be sent to next nodes.
-
stopProcess
default boolean stopProcess()
- Returns:
Trueif message should not be sent to others nodes after it was processed on coordinator.
-
createDiscoCache
DiscoCache createDiscoCache(GridDiscoveryManager mgr, AffinityTopologyVersion topVer, DiscoCache discoCache)
Creates new discovery cache if message caused topology version change.- Parameters:
mgr- Discovery manager.topVer- New topology version.discoCache- Current discovery cache.- Returns:
- Reused discovery cache.
-
-