Class MessageSource
java.lang.Object
dev.ua.theroer.magicutils.messaging.MessageSource
Identifies a member of the network for message origin and routing.
A source has a stable id (unique per running process) and a
type distinguishing the proxy from backend servers. Backends
additionally carry a server name as registered with the
proxy, which the proxy uses to route Target.server(String) messages.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhether a network member is a proxy or a backend server. -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageSourceCreates a backend source.booleaninthashCode()id()Returns the unique process id of this member.booleanisProxy()Returns whether this source is a proxy.static MessageSourceCreates a proxy source.@Nullable StringReturns the backend server name, when known.toString()type()Returns the member type.
-
Method Details
-
proxy
Creates a proxy source.- Parameters:
id- unique process id- Returns:
- proxy source
-
backend
Creates a backend source.- Parameters:
id- unique process idserverName- server name registered with the proxy (may be null when unknown)- Returns:
- backend source
-
id
-
type
-
serverName
Returns the backend server name, when known.- Returns:
- server name, or null for proxies / unknown backends
-
isProxy
public boolean isProxy()Returns whether this source is a proxy.- Returns:
- true when a proxy
-
equals
-
hashCode
-
toString
-