Creating the Load Balancer

The startup rule function has to be provided. It creates and returns a load balancer that can be used to send messages to load balanced remote destinations.

    Procedure
  1. Create the router TCP connection in a startup rule function.
    LoadBalancer.Router.createLoadBalancerTo(adhocConfigName);
  2. Send Event to the Receiver .
    Use this rule function as an event preprocessor. It sends an event to a remote receiver. The router agent does not have any destinations. The routing decision is made using the routing key.
    void LoadBalancer.Router.send(Object 
    				  loadBalancer , SimpleEvent 
    				  event, String 
    				  routingKey);
  3. Discard the Load Balancer.
    Put this rule function in a shutdown rule function.
    Object loadBalancer = Collections.Map.remove(Collections.Map.getMap(String mapID), Object key);
    Collections.Map.deleteMap(String mapID);
  4. This rulefunction discards the Load Balancer.
    void LoadBalancer.Router.discardLoadBalancer(Object loadBalancer);