Class CustomPolicy
- java.lang.Object
-
- com.yahoo.messagebus.routing.test.CustomPolicy
-
- All Implemented Interfaces:
RoutingPolicy
public class CustomPolicy extends java.lang.Object implements RoutingPolicy
- Author:
- Simon Thoresen Hult
-
-
Constructor Summary
Constructors Constructor Description CustomPolicy(boolean selectOnRetry, java.util.List<java.lang.Integer> consumableErrors, java.util.List<Route> routes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys this factory and frees up any resources it has held.void
merge(RoutingContext context)
This function is called when all replies have arrived for some message.void
select(RoutingContext context)
This function must choose a set of services that is to receive the given message from a list of possible recipients.
-
-
-
Constructor Detail
-
CustomPolicy
public CustomPolicy(boolean selectOnRetry, java.util.List<java.lang.Integer> consumableErrors, java.util.List<Route> routes)
-
-
Method Detail
-
select
public void select(RoutingContext context)
Description copied from interface:RoutingPolicy
This function must choose a set of services that is to receive the given message from a list of possible recipients. This is done by adding child routing contexts to the argument object. These children can then be iterated and manipulated even before selection pass is concluded.- Specified by:
select
in interfaceRoutingPolicy
- Parameters:
context
- the complete context for the invocation of this policy. Contains all available data.
-
merge
public void merge(RoutingContext context)
Description copied from interface:RoutingPolicy
This function is called when all replies have arrived for some message. The implementation is responsible for merging multiple replies into a single sensible reply. The replies is contained in the child context objects of the argument context, and then response must be set in that context.- Specified by:
merge
in interfaceRoutingPolicy
- Parameters:
context
- the complete context for the invocation of this policy. Contains all available data.
-
destroy
public void destroy()
Description copied from interface:RoutingPolicy
Destroys this factory and frees up any resources it has held. Making further calls on a destroyed factory causes a runtime exception.- Specified by:
destroy
in interfaceRoutingPolicy
-
-