Skip to content

Messaging Protocol into a Standalone Module#27

Draft
prkrtg wants to merge 4 commits intomainfrom
pgupta/protocol
Draft

Messaging Protocol into a Standalone Module#27
prkrtg wants to merge 4 commits intomainfrom
pgupta/protocol

Conversation

@prkrtg
Copy link
Collaborator

@prkrtg prkrtg commented Feb 12, 2026

Issue #19

The current implementation couples protocol semantics to the ZeroMQ transport layer. This makes it difficult to reason about the protocol independently of its transport. As the system evolves, this coupling increases maintenance overhead and limits extensibility.

The refactor introduces a layered structure where:
Protocol layer

  • Defines message structure
  • Defines semantic behavior
  • Provides user-facing APIs

Transport layer

  • Handles delivery mechanics only

By isolating protocol semantics, the messaging model becomes easier to understand, implement, and reuse across different languages and communication backends. This lays the foundation for supporting multiple transport types while reducing coupling between message structure and delivery mechanism. init.py has additional design notes for reference.

Protocol Architectural Direction

Application
  ↓
Protocol Facade
  ↓
Semantics
  ↓
Wire Codec
  ↓
Transport (ZMQ)

Added Protocol abstraction for user-facing messaging operations
Supports:

  • get()
  • set()
  • publish()
  • request()
  • serve() key handlers
    This centralizes orchestration logic previously spread across transport code.

With this change, follow-up work will migrate the existing mKTL implementation to use the separated protocol and transport layers. This transition will be performed incrementally to preserve current functionality while improving modularity and extensibility.

@jmader jmader requested review from 2ahunter and mkb0517 and removed request for mikelangmayr, scizen9 and tylertucker202 February 13, 2026 17:50
@klanclos
Copy link
Contributor

I checked out this branch to experiment with the changes, but the existing tooling doesn't work with it; I'm hoping the required additional changes are minimal, because this pull request is already extensive, but I think we're going to need those changes to see how this proposed structure changes how the core functionality gets used.

Importing the module presently doesn't work, so none of the existing tools work, throwing this exception:

AttributeError: module 'mktl.protocol.request' has no attribute 'Server'

I imagine there will be others once that's resolved.

@jmader jmader marked this pull request as draft February 18, 2026 16:51
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.

Messaging Protocol into a Standalone Module

2 participants