Message correlation key. Correlation keys are used to match up incoming messages with a particular process instance. The basic procedure is to generate and save a correlation key when a receive
or pick activity is activated, and then to match incoming messages against all correlation keys so saved, finally associating the message with the process instance that had the matching correlation key. In reality this process is somewhat more complicated as pains must be taken to avoid race conditions and to make the matching efficient.
The correlation keys used in the above process consists of a collection of name-value pairs, with the name corresponding to a property name (as defined using the <property>
element of the BPEL process document) and with the value corresponding to the value of said property as obtained from a message by means of a property alias (as defined using the <propertyAlias;>
BPEL process document element).
*/
public void run() {
Selector selector;
try {
PickResponseChannel pickResponseChannel = newChannel(PickResponseChannel.class);
CorrelationKey key;
PartnerLinkInstance pLinkInstance = _scopeFrame.resolve(_oevent.partnerLink);
if (_oevent.matchCorrelation == null) {
// Adding a route for opaque correlation. In this case correlation is done on "out-of-band" session id.
String sessionId = getBpelRuntime().fetchMySessionId(pLinkInstance);
key = new CorrelationKey(-1, new String[] {sessionId});
} else {
if (!getBpelRuntime().isCorrelationInitialized(_scopeFrame.resolve(_oevent.matchCorrelation))) {
throw new FaultException(_oevent.getOwner().constants.qnCorrelationViolation,"Correlation not initialized.");
}
key = getBpelRuntime().readCorrelation(_scopeFrame.resolve(_oevent.matchCorrelation));
propNames[i] = property.name.toString();
if (__log.isDebugEnabled())
__log.debug("Setting correlation property " + propNames[i] + "=" + propValues[i]);
}
CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.getId(), propValues);
ckeyVal.setUnique(cset.declaration.isUnique());
getBpelRuntime().writeCorrelation(cset,ckeyVal);
}
propNames[i] = property.name.toString();
if (__log.isDebugEnabled())
__log.debug("Setting correlation property " + propNames[i] + "=" + propValues[i]);
}
CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.getId(), propValues);
ckeyVal.setUnique(cset.declaration.isUnique());
getBpelRuntime().writeCorrelation(cset,ckeyVal);
}
getSession().update(_correlationSet);
}
public CorrelationKey getValue() {
entering("CorrelationSetDaoImpl.getValue");
if (_correlationSet.getValue() != null) return new CorrelationKey(_correlationSet.getValue());
else return null;
}
if (matchCorrelations.isEmpty() && !_opick.createInstanceFlag) {
// Adding a route for opaque correlation. In this case,
// correlation is on "out-of-band" session-id
String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
keySet.add(new CorrelationKey("-1", new String[] { sessionId }));
} else if (!matchCorrelations.isEmpty()) {
for( OScope.CorrelationSet cset : matchCorrelations ) {
CorrelationKey key = null;
if(!getBpelRuntimeContext().isCorrelationInitialized(
_scopeFrame.resolve(cset))) {
if (!_opick.createInstanceFlag) {
throw new FaultException(_opick.getOwner().constants.qnCorrelationViolation,
public Long getId() {
return _id;
}
public CorrelationKey getCorrelationKey() {
return new CorrelationKey(_correlationKey);
}
return _scope;
}
public CorrelationKey getValue() {
if (_correlationKey == null) return null;
return new CorrelationKey(_correlationKey);
}
public void setCorrelationKey(CorrelationKey key) {
_selector.setCorrelationKey(key.toCanonicalString());
}
public CorrelationKey getCorrelationKey() {
return new CorrelationKey(_selector.getCorrelationKey());
}
private ProcessInstanceDAO createProcessInstance(ProcessDAO process, CorrelatorDAO corr) throws SAXException, IOException {
ProcessInstanceDAO pi = null;
String[] actions = { "action1","action2" };
String[] correlationKeys = { "key1", "key2" };
CorrelationKey key1 = new CorrelationKey("key1",correlationKeys);
CorrelationKey key2 = new CorrelationKey("key2",correlationKeys);
CorrelationKey[] corrkeys = {key1,key2};
QName[] names = { new QName(TEST_NS,"name1"), new QName(TEST_NS,"name2") };
pi = process.createInstance(corr);
OProcess.OProperty property = cset.declaration.properties.get(i);
propValues[i] = readProperty(variable, property);
propNames[i] = property.name.toString();
}
CorrelationKey ckeyVal = new CorrelationKey(cset.declaration.name, propValues);
writeCorrelation(cset, ckeyVal);
}
Related Classes of org.apache.ode.bpel.common.CorrelationKey
Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.