You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by "pivotal-jbarrett (GitHub)" <gi...@apache.org> on 2019/01/04 03:59:30 UTC
[GitHub] [geode-native] pivotal-jbarrett commented on issue #430:
GEODE-6210: Add 'transaction' example for cpp
Something like:
```c++
main() {
...
transactionManager.begin();
try {
for (auto& key : batch) {
auto value = getValueFromExternalSystem(key);
cache.put(key, value);
}
transactionManager.commit();
} catch ( ... ) {
transactionManager.rollback();
}
}
int32_t getValuFromExternalSystem(int32_t key) {
if (random(10) == 0) {
throw "failed to get from external system";
}
return random(key);
}
```
[ Full content available at: https://github.com/apache/geode-native/pull/430 ]
This message was relayed via gitbox.apache.org for notifications@geode.apache.org