Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cosmetic] Completed the javadocs for the newly refactored RoutingStr…
…ategy interface.
  • Loading branch information
Jim Carroll committed May 15, 2012
1 parent 963c432 commit 664a089
Showing 1 changed file with 39 additions and 0 deletions.
Expand Up @@ -20,11 +20,13 @@

import com.nokia.dempsy.DempsyException;
import com.nokia.dempsy.annotations.MessageKey;
import com.nokia.dempsy.annotations.MessageProcessor;
import com.nokia.dempsy.config.ApplicationDefinition;
import com.nokia.dempsy.config.ClusterDefinition;
import com.nokia.dempsy.config.ClusterId;
import com.nokia.dempsy.messagetransport.Destination;
import com.nokia.dempsy.mpcluster.MpCluster;
import com.nokia.dempsy.router.RoutingStrategy.Outbound.Coordinator;

/**
* <p>A {@link RoutingStrategy} is responsible for determining how to find the appropriate
Expand Down Expand Up @@ -64,6 +66,11 @@
*/
public interface RoutingStrategy
{
/**
* For every possible destination from a node to a downstream cluster there is an instance of an Outbound.
* The responsibility of the Outbound is to reliably determine which node (Destination) to send each
* message to for a given downstream cluster.
*/
public static interface Outbound
{
/**
Expand Down Expand Up @@ -111,17 +118,49 @@ public static interface Coordinator

}

/**
* Shut down and reclaim any resources associated with the {@link Outbound} instance.
*/
public void stop();

}

/**
* The primary responsibility of an Inbound is to set the appropriate information in the cluster
* manager associated with the node within which the Inbound was instantiated. As described
* for the {@link RoutingStrategy}, the Inbound should supply information to the cluster manager
* that the {@link Outbound} from an upstream node will use to determine which messages are
* targeted to 'this' node.
*/
public static interface Inbound
{
/**
* Since the {@link Inbound} has the responsibility to determine which instances of a
* {@link MessageProcessor} are valid in 'this' node, it should be able to privide that
* information through the implementataion of this method. This is used as part of the
* Pre-instantiation phase of the Message Processor's lifecylce.
*/
public boolean doesMessageKeyBelongToNode(Object messageKey);

/**
* Shut down and reclaim any resources associated with the {@link Inbound} instance.
*/
public void stop();
}

/**
* This method will be called from the Dempsy framework in order to instantiate the one Inbound for
* 'this' node. Keep in mind that when running in LocalVm mode there can be more than one inbound per
* process.
*
* @param cluster is the cluster information manager handle for 'this' node.
* @param messageTypes is the types of messages that Dempsy determined could be handled by the {@link MessageProcessor}
* in this node. This information should be shared across to the {@link Outbound} and registered with
* the {@link Coordinator} to allow Dempsy to restrict messages to the appropriate types.
* @param thisDestination is the transport Destination instance that represents how to communicate
* with 'this' node.
* @return the {@link Inbound} instance.
*/
public Inbound createInbound(MpCluster<ClusterInformation, SlotInformation> cluster, Collection<Class<?>> messageTypes, Destination thisDestination);

/**
Expand Down

0 comments on commit 664a089

Please sign in to comment.