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.
        Returns:
        The name.
      • 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 for.
        routable - 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 routable.
        payload - The payload to decode from.
        Returns:
        The decoded routable.
      • 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 create.
        param - The parameter to that policy's constructor.
        Returns:
        The created policy.