Transferring data from the conductor node to player nodes (DataStage)
The Java™ Integration stage provides your Java code with the DataChannel interface to
transfer data from the conductor node to the player nodes.
DataChannel interface provides the following methods: sendTo()receiveFrom()
To get an instance of the DataChannel interface, your Java code calls the getDataChannel method of the
Configuration class. To send data from the conductor node, your Java code calls the sendTo method. To receive data on each
player node, your Java code calls the
receiveFrom method.
To enable the data transfer service capability during the stage initialization and termination
processes, your Java code calls the
setIsRunOnConductor method of the Capabilities class. The
getDataChannel method returns null if the capability is not enabled.
In the following example code, Java code passes string data from the conductor node to player nodes.
private int m_nodeID = -1;
public boolean validateConfiguration(Configuration configuration, boolean isRuntime) throws Exception
{
...
m_nodeID = configuration.getNodeNumber();
if (isRuntime == true)
{
// Get data channel
DataChannel channel = configuration.getDataChannel();
if (m_nodeID == -1) // On Conductor node
{
// Send data to the player node
String object = new String("*** test data ***");
Logger.information(object + " is sent from Conductor to Player. ");
channel.sendTo(DataChannel.NODE_PLAYER, object);
}
else // On Player node
{
// Receive data from the conductor node
String object = (String) channel.receiveFrom(DataChannel.NODE_CONDUCTOR);
Logger.information(object + "is received on Player(" + m_nodeID + ").");
}
}
...
return true;
}
Java_Stage: *** test data *** is set on the Conductor node. Java_Stage,0: *** test data *** is received on Player(0). Java_Stage,1: *** test data *** is received on Player(1).