Skip to content

Tunnels - fjåge version of UnetStack wormholes#393

Merged
mchitre merged 12 commits intomasterfrom
wormhole2
Mar 30, 2026
Merged

Tunnels - fjåge version of UnetStack wormholes#393
mchitre merged 12 commits intomasterfrom
wormhole2

Conversation

@mchitre
Copy link
Copy Markdown
Member

@mchitre mchitre commented Mar 29, 2026

Implements tunnels that allow multiple fjåge universes to be connected over TCP/IP.

Example usage

fjåge container 1:

> container.add 't1', new org.arl.fjage.remote.Tunnel(12345);
> subscribe topic('sharedTopic')

fjåge container 2:

> container.add 't2', new org.arl.fjage.remote.Tunnel('localhost', 12345);
> subscribe topic('sharedTopic')
> t2.agents = [agent('t1'), topic('sharedTopic')]
[t1, sharedTopic]

> agent('t1')       // access agent t1 through the tunnel
« Tunnel »

Tunnel listening on port 12345 (1 connection)

[org.arl.fjage.remote.TunnelParam]
  agents = []
  ip ⤇ null
  port ⤇ 12345

> send new Message(recipient: topic('sharedTopic'))
true
shell >> INFORM

You should see that message in container 1 too:

fjåge container 1:

shell@1 >> INFORM

Additional notes

  • Server and client can be started in any order.
  • Client will reconnect to server if it loses connections (retries every 5 seconds).
  • @id suffix is added to remote agent names to avoid confusion with similar named local agents. The id is auto-generated and has no user-facing semantics other than to make agentIDs unique in each container.
  • ip and port can only be setup when loading the agent and cannot be modified during runtime. An agent can be killed and re-loaded, if a different IP or port is desired.
  • To get detailed logs of every message exchange, do: logLevel 'org.arl.fjage.remote', FINE

@mchitre mchitre marked this pull request as ready for review March 29, 2026 09:53
@mchitre mchitre requested a review from Copilot March 29, 2026 09:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Tunnel agent to bridge selected agents/topics between multiple fjåge containers over TCP/IP, conceptually similar to UnetStack “wormholes”.

Changes:

  • Added org.arl.fjage.remote.Tunnel agent to forward messages over newline-delimited JSON/TCP connections.
  • Added TunnelParam enum to expose tunnel parameters (ip, port, agents) via the existing parameter mechanism.
  • Simplified TcpConnector.connections() implementation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
src/main/java/org/arl/fjage/remote/TunnelParam.java Defines tunnel parameter names for parameter messaging.
src/main/java/org/arl/fjage/remote/Tunnel.java Implements TCP-based tunneling/forwarding logic between containers.
src/main/java/org/arl/fjage/connectors/TcpConnector.java Refactors connections() method formatting/flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mchitre mchitre requested review from notthetup and removed request for notthetup March 30, 2026 09:20
@mchitre mchitre merged commit 188fb7c into master Mar 30, 2026
1 of 2 checks passed
@mchitre mchitre deleted the wormhole2 branch March 30, 2026 15:41
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.

3 participants