You can leverage the
/**
* Update the state value for the key.
*
* @param key name of the key
* @param value state value of the key
*/
void putState(String key, ByteBuffer value);
and
/**
* Retrieve the state value for the key.
*
* @param key name of the key
* @return the state value for the key.
*/
ByteBuffer getState(String key);
methods of the Context Object to accomplish this as long as you coordinate the key you will use between the functions. The aggregate function would perform the calculation and store the data using the putState method and a pre-determined key like so:
public class AggregateFunction implements Function<String, Void> {
@Override
public Void process(String input, Context context) {
ByteBuffer value;
// Calculate value and place in ByteBuffer
context.putState("PRE-DETERMINED-KEY", value);
}
}
the consuming functions can then access this value like so;
public class ConsumingFunction implements Function<String, String> {
@Override
public String process(String input, Context context) {
ByteBuffer value = context.gettState("PRE-DETERMINED-KEY");
// Perform logic based on the value.
return "";
}
}