Class TopicController
java.lang.Object
com.loomcache.springboot.controller.TopicController
@RestController
@Conditional(LoomServerEnabledCondition.class)
@ConditionalOnBean(LoomCache.class)
@RequestMapping("/api/topic")
public class TopicController
extends Object
REST controller for DistributedTopic operations.
Endpoints: POST /api/topic — publish a message to all subscribers GET /api/topic/stats — get topic statistics
-
Constructor Summary
ConstructorsConstructorDescriptionTopicController(DistributedTopic<String> defaultTopic, CacheNode cacheNode, LoomCache loomCache) Create a TopicController with a DistributedTopic. -
Method Summary
-
Constructor Details
-
TopicController
public TopicController(DistributedTopic<String> defaultTopic, CacheNode cacheNode, LoomCache loomCache) Create a TopicController with a DistributedTopic.- Parameters:
defaultTopic- the distributed topic to use (must not be null)- Throws:
NullPointerException- if defaultTopic is null
-
-
Method Details
-
publish
@RolesAllowed({"ADMIN","USER"}) @PostMapping public org.springframework.http.ResponseEntity<Map<String,Object>> publish(@RequestBody @Nullable String message) Publish a message to all subscribers of the topic.- Parameters:
message- the message to publish (plain string in request body, must not be null)- Returns:
- response with published flag, subscriber count, and total published count
-
stats
-