Class TransactionController

java.lang.Object
com.loomcache.springboot.controller.TransactionController

@RestController @Conditional(LoomServerEnabledCondition.class) @RequestMapping("/api/transactions") public class TransactionController extends Object
REST controller for managing server-side transactions.

Endpoints

  • POST /api/transactions — begin a transaction
  • POST /api/transactions/{id}/operations — buffer an operation
  • POST /api/transactions/{id}/commit — commit a transaction
  • POST /api/transactions/{id}/rollback — rollback a transaction

The controller talks directly to the embedded CacheNode's TransactionManager — it does not go over TCP. For cross-node work use the TCP wire protocol via LoomClient#newTransaction() instead.

  • Constructor Details

    • TransactionController

      public TransactionController(CacheNode cacheNode)
  • Method Details

    • begin

      @RolesAllowed({"ADMIN","USER"}) @PostMapping public org.springframework.http.ResponseEntity<Map<String,Object>> begin(@Valid @RequestBody(required=false) @Valid @Nullable TransactionController.BeginRequest request)
    • addOperation

      @RolesAllowed({"ADMIN","USER"}) @PostMapping("/{id}/operations") public org.springframework.http.ResponseEntity<Map<String,Object>> addOperation(@PathVariable String id, @Valid @RequestBody @Valid TransactionController.OperationRequest request)
    • commit

      @RolesAllowed({"ADMIN","USER"}) @PostMapping("/{id}/commit") public org.springframework.http.ResponseEntity<Map<String,Object>> commit(@PathVariable String id)
    • rollback

      @RolesAllowed({"ADMIN","USER"}) @PostMapping("/{id}/rollback") public org.springframework.http.ResponseEntity<Map<String,Object>> rollback(@PathVariable String id)