Package com.yahoo.messagebus
Interface Protocol
- All Known Implementing Classes:
SimpleProtocol
public interface Protocol
Interface implemented by the concrete application message protocol.
- Author:
- bratseth, Simon Thoresen Hult
-
Method Summary
Modifier and TypeMethodDescriptioncreatePolicy
(String name, String param) Create a policy of the named type with the named param passed to the constructor of that policy.decode
(com.yahoo.component.Version version, byte[] payload) Decodes the protocol specific data into a routable of the correct type.byte[]
Encodes the protocol specific data of a routable into a byte array.getName()
Returns a global unique name for this protocol.
-
Method Details
-
getName
String getName()Returns a global unique name for this protocol. -
encode
Encodes the protocol specific data of a routable into a byte array.- Parameters:
version
- the version to encode forroutable
- the routable to encode- Returns:
- the encoded data
-
decode
Decodes the protocol specific data into a routable of the correct type.- Parameters:
version
- the version of the serialized routablepayload
- the payload to decode from- Returns:
- the decoded routable, or null if it could not be decoded
-
createPolicy
Create a policy of the named type with the named param passed to the constructor of that policy.- Parameters:
name
- the name of the policy to createparam
- the parameter to that policy's constructor- Returns:
- the created policy
-