Class ErrorPolicy

java.lang.Object
com.yahoo.documentapi.messagebus.protocol.ErrorPolicy
All Implemented Interfaces:
DocumentProtocolRoutingPolicy, com.yahoo.messagebus.routing.RoutingPolicy

public class ErrorPolicy extends Object implements DocumentProtocolRoutingPolicy
This policy assigns an error supplied at constructor time to the routing context when select(RoutingContext) is invoked. This is useful for returning error states to the client instead of those auto-generated by mbus when a routing policy can not be created.
Author:
Simon Thoresen Hult
  • Constructor Details

    • ErrorPolicy

      public ErrorPolicy(String msg)
      Creates a new policy that will assign an EmptyReply with the given error to all routing contexts that invoke select(RoutingContext).
      Parameters:
      msg - The message of the error to assign.
  • Method Details

    • select

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

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

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