Skip to main content
Jump to: navigation, search

Difference between revisions of "EIG:JGroups provider"

(JGroups use)
(JGroups use)
Line 45: Line 45:
 
</source>
 
</source>
  
Then, we can repeat this operation as the number of container we want as.
+
Then, we can repeat this operation as many times as needed.
  
Now, we want work with the group, relying on JGroups reliable multicast protocols.
+
Now, we could work with the group, relying on JGroups reliable multicast protocols.
  
 
=== A sample JGroups client container ===
 
=== A sample JGroups client container ===

Revision as of 04:39, 3 March 2011

JGroups provider

JGroups provider allows to adapt the JGroups protocol to an ECF container, consequently providing all of JGroups capabilities to ECF applications.

Protocol JGroups is documented at the JGroups site.

JGroups container instantiation

JGroups container ID : ecf.jgroups.manager

Sample code:

IContainerFactory factory = getContainerManager().getContainerFactory();
IContainer containerManager = factory.createContainer( "ecf.jgroups.manager", "jgroups:///testConfig?stackName=udp" );

All stack names (refer to JGroups site for explanation of stacks) are available in the conf/ directory of distribution plugin. The stack description begins with a config tag. This config can be cut and added in a protocol stack (protocol_stacks) to configure the transport. There is a default stack configured by default with ID : org.eclipse.ecf.provider.jgroups.default. This stack can be configured with the extension point org.eclipse.ecf.provider.jgroups.stackConfig, providing an ID and a config file.

The way to initialize a container with his own stack is therefore:

IContainer containerManager = factory.createContainer( "ecf.jgroups.manager", "jgroups:///testConfig?stackID=mystack" );

A file named mystack.xml should have been configured and linked to the extension point in the JGroups plugin.

JGroups use

Now that the container is initialized, we can use it.

First, we create a client container for the JGroups provider:

IContainer client = ContainerFactory.getDefault().createContainer("ecf.jgroups.client");

Second, we must connect our newly created container to the JGroups group.

		final ID targetID = IDFactory.getDefault().createID(
				client.getConnectNamespace(),
				new Object[] { "jgroups:///testConfig?stackID=mystack" });
		client.connect(targetID, null);

Then, we can repeat this operation as many times as needed.

Now, we could work with the group, relying on JGroups reliable multicast protocols.

A sample JGroups client container

Copyright © Eclipse Foundation, Inc. All Rights Reserved.