Class DocumentRouteSelectorPolicy

java.lang.Object
com.yahoo.documentapi.messagebus.protocol.DocumentRouteSelectorPolicy
All Implemented Interfaces:
com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<DocumentrouteselectorpolicyConfig>, DocumentProtocolRoutingPolicy, com.yahoo.messagebus.routing.RoutingPolicy

public class DocumentRouteSelectorPolicy extends Object implements DocumentProtocolRoutingPolicy, com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<DocumentrouteselectorpolicyConfig>
This policy is responsible for selecting among the given recipient routes according to the configured document selection properties. To facilitate this the "routing" plugin in the vespa model builds a mapping from the route names to a document selector and a feed name of every search cluster. This can very well be extended to include storage at a later time.
Author:
Simon Thoresen Hult
  • Constructor Details

    • DocumentRouteSelectorPolicy

      public DocumentRouteSelectorPolicy(DocumentProtocolPoliciesConfig config)
      This policy is constructed with the proper config at its time of creation.
    • DocumentRouteSelectorPolicy

      public DocumentRouteSelectorPolicy(String configId)
      This policy is constructed with a configuration identifier that can be subscribed to for the document selector config. If the string is either null or empty it will default to the proper one.
      Parameters:
      configId - The configuration identifier to subscribe to.
  • Method Details

    • getError

      public String getError()
      This is a safety mechanism to allow the constructor to fail and signal that it can not be used.
      Returns:
      The error string, or null if no error.
    • configure

      public void configure(DocumentrouteselectorpolicyConfig cfg)
      This method is called when configuration arrives from the config server. The received config object is traversed and a local map is constructed and swapped with the current config map.
      Specified by:
      configure in interface com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<DocumentrouteselectorpolicyConfig>
      Parameters:
      cfg - The configuration object given by subscription.
    • select

      public void select(com.yahoo.messagebus.routing.RoutingContext context)
      Specified by:
      select in interface com.yahoo.messagebus.routing.RoutingPolicy
    • merge

      public void merge(com.yahoo.messagebus.routing.RoutingContext context)
      Specified by:
      merge in interface com.yahoo.messagebus.routing.RoutingPolicy
    • destroy

      public void destroy()
      Specified by:
      destroy in interface com.yahoo.messagebus.routing.RoutingPolicy