Stateless vs stateful Graft calls

Concepts

ModeMeaning
Static methodType-level call; no remote object handle
Instance methodBound to remote object identity across calls
stateless = trueGenerated/runtime hint for independently routable operations
stateless = falseAllows stateful remote object semantics

stateless does not remove serialization or network failure modes for remote calls.

Examples

// Stateless static call — preferred for remote routing
GraftConfig.Host = "ws://localhost/ws";
GraftConfig.Stateless = true;
var total = PriceService.Calculate(10, 5);
// Stateful instance — object identity may not survive Gateway restart
var svc = new PriceService();
var value = svc.Calculate(10, 5);
## When to use which
  • Prefer static + stateless for idempotent reads and independent operations behind load balancers.
  • Use instances when the domain model requires constructor inputs and follow-up calls on the same object—and accept affinity requirements.

See Static and instance context.

Next steps