Issue Details (XML | Word | Printable)

Key: OPENEJB-816
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Youcef HILEM
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenEJB

loadbalancing & failover of stateless beans

Created: 04/Jun/08 08:14 AM   Updated: 18/Jan/09 01:17 PM
Return to search
Component/s: general
Affects Version/s: 3.1.x
Fix Version/s: None

Time Tracking:
Not Specified

Issue Links:
Reference
 


 Description  « Hide
Following the exchanges in the mailing-list users@openejb.apache.org: "loadbalancing & failover of stateless beans," I ask adding:

- a way to specify a list of URLs as an InitialContext param
- a way to specify the ConnectionFactoryStrategy via an additional InitialContext param
- one ore more conection strategies


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
David Blevins added a comment - 18/Jan/09 01:17 PM
These linked issues released in 3.1 solve this request for the most part. It is possible to failover from one server to the next. We don't yet have the ability to feed the server list via a initialcontext parameter -- we should be able to get that in, it was simply overlooked.

If multicast is used a server list will be created automatically and each client on first request which gives a stateless failover where the server list automatically updates as servers come and go from the cluster.

Alternatively, you can now register a new ConnectionFactory by simply including a "META-INF/org.apache.openejb.client.ConnectionFactory/foo" file in your classpath where "foo" is the protocol prefix you wish to control and the file "foo" points to an implementation of org.apache.openejb.client.ConnectionFactory. A basic implementation might look like:

{code}
import java.io.IOException;
import java.net.URI;
import org.apache.openejb.client.ConnectionFactory;
import org.apache.openejb.client.ConnectionManager;

/**
 * Handles any connection requests for URIs that start with "foo:"
 *
 * @version $Rev$ $Date$
 */
public class FooConnectionFactory implements ConnectionFactory {

    /**
     * Get a connection using the URI specified.
     *
     * @param uri in most cases will be the value of "java.naming.provider.url"
     * as specified in the InitialContext parameters
     * @return
     * @throws IOException
     */
    public Connection getConnection(URI uri) throws IOException {
        // Get the URIs from a System property or possibly
        // create some URI format that can be split or expanded
        // into a list of "ejbd:" URIs
        URI[] uris = null;

        for (URI serverURI : uris) {
            // serverURI should be an "ejbd:" or similar URI handleable
            // by the built-in ConnectionFactory implementations.
            return ConnectionManager.getConnection(serverURI);
        }

        throw new IOException("No Server URIs specified");
    }
}
{code}