Package com.yahoo.messagebus
Interface Protocol
-
public interface Protocol
Interface implemented by the concrete application message protocol.- Author:
- bratseth, Simon Thoresen Hult
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description com.yahoo.messagebus.routing.RoutingPolicy
createPolicy(java.lang.String name, java.lang.String param)
Create a policy of the named type with the named param passed to the constructor of that policy.Routable
decode(com.yahoo.component.Version version, byte[] payload)
Decodes the protocol specific data into a routable of the correct type.byte[]
encode(com.yahoo.component.Version version, Routable routable)
Encodes the protocol specific data of a routable into a byte array.java.lang.String
getName()
Returns a global unique name for this protocol.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns a global unique name for this protocol.
-
encode
byte[] encode(com.yahoo.component.Version version, Routable routable)
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
Routable decode(com.yahoo.component.Version version, byte[] payload)
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
com.yahoo.messagebus.routing.RoutingPolicy createPolicy(java.lang.String name, java.lang.String param)
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
-
-