Skip to content

Tiny java topology example#300

Draft
tommy-mor wants to merge 3 commits intomasterfrom
tiny-java-topology-example
Draft

Tiny java topology example#300
tommy-mor wants to merge 3 commits intomasterfrom
tiny-java-topology-example

Conversation

@tommy-mor
Copy link
Copy Markdown
Collaborator

tommy-mor and others added 3 commits March 24, 2026 11:14
…logies with agents

Demonstrates both integration patterns from the wiki:

1. AgentOwnedPStateModule — PState declared via agentTopology.declarePStateStore(),
   owned by the AgentTopology's internal stream topology, fully read/write from agents.

2. ExternalPStateModule — PState declared on a separate topologies.stream() topology
   before the AgentTopology is created, accessed read-only by agents via getStore().

Both modules include RecordAgent (depot append) and CountAgent (PState read).
Tests verify both strategies produce correct counts end-to-end with InProcessCluster.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…egies

Strategy 1 (AgentTopology owns PState): add ResetAgent that calls transform()
directly on the PState from within an agent node, proving agents can write it.

Strategy 2 (external StreamTopology owns PState): no ResetAgent — agents only
call selectOne(), and the test asserts ResetAgent doesn't exist in the module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…h in Strategy 2

- Rename $$event-counts -> $$eventCounts (camelCase for Java examples)
- Strategy 2 ResetAgent now appends to *resetCommands depot; the external
  stream topology consumes it and zeroes the PState — demonstrating that
  to modify a PState in another topology you must go through a depot
- Strategy 1 ResetAgent still uses direct transform() since AgentTopology
  owns the PState
- Both strategies now have a working ResetAgent with matching test coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant