Package io.hekate.messaging
Interface MessageBase<T>
-
- Type Parameters:
T
- Payload type.
- All Known Subinterfaces:
Message<T>
,Response<T>
,ResponsePart<T>
public interface MessageBase<T>
Base interface for messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default MessagingChannel<T>
channel()
Returns the messaging channel of this message.MessagingEndpoint<T>
endpoint()
Returns the messaging endpoint of this message..default ClusterAddress
from()
Returns the universally unique identifier of the remote cluster node.boolean
is(Class<? extends T> type)
Returnstrue
if this message has apayload
of the specified type.T
payload()
Returns the payload of this message.<P extends T>
Ppayload(Class<P> type)
Casts the payload of this message to the specified type.
-
-
-
Method Detail
-
payload
T payload()
Returns the payload of this message.- Returns:
- Payload.
-
payload
<P extends T> P payload(Class<P> type)
Casts the payload of this message to the specified type.- Type Parameters:
P
- Payload type.- Parameters:
type
- Payload type.- Returns:
- Payload.
- Throws:
ClassCastException
- If payload can't be cast to the specified type.
-
is
boolean is(Class<? extends T> type)
Returnstrue
if this message has apayload
of the specified type.- Parameters:
type
- Payload type.- Returns:
true
if this message has apayload
of the specified type.
-
endpoint
MessagingEndpoint<T> endpoint()
Returns the messaging endpoint of this message..- Returns:
- Messaging endpoint.
-
channel
default MessagingChannel<T> channel()
Returns the messaging channel of this message.- Returns:
- Messaging channel.
-
from
default ClusterAddress from()
Returns the universally unique identifier of the remote cluster node.- Returns:
- Universally unique identifier of the remote cluster node.
- See Also:
ClusterNode.id()
-
-