org.codehaus.activespace
Interface SpaceFactory

All Known Implementing Classes:
JmsSpaceFactory

public interface SpaceFactory

Represents a factory of Space instances

Version:
$Revision: 1.5 $

Field Summary
static int DISPATCH_ALL_CONSUMERS
          The dispatch mode where each consumer of the space will get its own copy of each object (assuming it matches whatever filters the consumer may be using).
static int DISPATCH_ONE_CONSUMER
          The dispatch mode when only one consumer of the space will see each object.
static int DISPATCH_ONE_CONSUMER_EXCLUSIVE
          The dispatch mode which is like DISPATCH_ONE_CONSUMER mode except that to ensure total ordering across objects put into the space across multiple consumers in different threads and/or processes we use a sticky-load balancing stategy where one consumer is chosen per space to process all the objects in order (assuming it matches the filter) and then if that consumer fails, another one is chosen.
 
Method Summary
 Space createSpace(String destination, int dispatchMode, String filter)
          Creates a new Space.
 

Field Detail

DISPATCH_ONE_CONSUMER

public static final int DISPATCH_ONE_CONSUMER
The dispatch mode when only one consumer of the space will see each object. If there are multiple consumers of a space then objects put into the space will be load balanced across the consumers. In messaging / MOM worlds this is referred to as queue semantics

See Also:
Constant Field Values

DISPATCH_ALL_CONSUMERS

public static final int DISPATCH_ALL_CONSUMERS
The dispatch mode where each consumer of the space will get its own copy of each object (assuming it matches whatever filters the consumer may be using). In messaging / MOM worlds this is referred to as publish / subscribe semantics

See Also:
Constant Field Values

DISPATCH_ONE_CONSUMER_EXCLUSIVE

public static final int DISPATCH_ONE_CONSUMER_EXCLUSIVE
The dispatch mode which is like DISPATCH_ONE_CONSUMER mode except that to ensure total ordering across objects put into the space across multiple consumers in different threads and/or processes we use a sticky-load balancing stategy where one consumer is chosen per space to process all the objects in order (assuming it matches the filter) and then if that consumer fails, another one is chosen.

Even though spaces using DISPATCH_ONE_CONSUMER will preserve order of objects put into the space, sometimes in a multi-threaded / multi-process environment one consumer may actually process an object ahead of the other (e.g. commit on a database first, schedulers can context switch and so forth).

So this mode of dispatch ensures that only 1 consumer is processing the space at any point in time to ensure total ordering.

In messaging / MOM worlds this is sometimes referred to as exclusive queue or sticky queue semantics

See Also:
Constant Field Values
Method Detail

createSpace

public Space createSpace(String destination,
                         int dispatchMode,
                         String filter)
                  throws SpaceException
Creates a new Space. The destination is a logical name which supports a hierarchial namespace with wildcards like most message bus systems.

Parameters:
destination - the logical destination; this allows you to keep spaces separate or to build them into hierarchies
dispatchMode - specifies the dispatch mode of the space, whether only once consumer of the space will get each object, DISPATCH_ONE_CONSUMER, or whether all consumers of the space will get their own copy of the object, DISPATCH_ALL_CONSUMERS or whether only one consumer will get each object and strict ordering is used, DISPATCH_ONE_CONSUMER_EXCLUSIVE i.e. only one consumer is used until it is decided that the consumer has failed and then another consumer is chosen so that strict ordering is maintained across both multi-threaded & multi-process scenarios).
filter - an SQL 92 query string to filter the space or null if no filter is required
Returns:
a newly created space
Throws:
SpaceException


Copyright © 2004 Protique, Ltd.. All Rights Reserved.