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 whenselect(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 Summary
Constructors Constructor Description ErrorPolicy(String msg)
Creates a new policy that will assign anEmptyReply
with the given error to all routing contexts that invokeselect(RoutingContext)
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
merge(com.yahoo.messagebus.routing.RoutingContext ctx)
void
select(com.yahoo.messagebus.routing.RoutingContext ctx)
-
-
-
Constructor Detail
-
ErrorPolicy
public ErrorPolicy(String msg)
Creates a new policy that will assign anEmptyReply
with the given error to all routing contexts that invokeselect(RoutingContext)
.- Parameters:
msg
- The message of the error to assign.
-
-
Method Detail
-
select
public void select(com.yahoo.messagebus.routing.RoutingContext ctx)
- Specified by:
select
in interfacecom.yahoo.messagebus.routing.RoutingPolicy
-
merge
public void merge(com.yahoo.messagebus.routing.RoutingContext ctx)
- Specified by:
merge
in interfacecom.yahoo.messagebus.routing.RoutingPolicy
-
destroy
public void destroy()
- Specified by:
destroy
in interfacecom.yahoo.messagebus.routing.RoutingPolicy
-
-