Record Class Member
- Record Components:
name- the node id of this member, unique to the application process it represents. It is also what decides the member's positions on theConsistentHashring, so every member of the cluster places it the same wayendpoint- the baseURIto reach this member over HTTP, ornullfor alocalmemberlocal-truewhen this member represents the application it is constructed in,falsewhen it represents another node
A Member is identified by the node id the application reports about itself, rather than by anything the
discovery client reports about it, so that an application reported more than once is still one member. Its endpoint
comes from the ServiceInstance the discovery client reported it as. A Member is what the
ConsistentHash ring resolves a command's routing key to, and what a query name resolves to when the members
advertising it are rotated over. The local flag decides how a message addressed to this member is
delivered: a local member is handled through the registered handler of this application's own connector, while a
remote member is reached over HTTP at its endpoint.
A local member has no endpoint, since it is never reached over HTTP. A remote member without an endpoint
cannot be reached at all, and is rejected on construction.
- Since:
- 5.4.0
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable URIendpoint()Returns the value of theendpointrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanlocal()Returns the value of thelocalrecord component.static MemberlocalMember(String name) Constructs the localMemberrepresenting the application it is constructed in.name()Returns the value of thenamerecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
Member
Compact constructor validating that thenameis present, and that a non-localmember carries anendpointto reach it at.
-
-
Method Details
-
localMember
Constructs the localMemberrepresenting the application it is constructed in.- Parameters:
name- the node id of this application- Returns:
- a local
Memberwithout an endpoint
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
endpoint
Returns the value of theendpointrecord component.- Returns:
- the value of the
endpointrecord component
-
local
public boolean local()Returns the value of thelocalrecord component.- Returns:
- the value of the
localrecord component
-