Skip to content

feat: Message data classes - #284

Open
chrisk314 wants to merge 4 commits into
mainfrom
feat/message-data-classes
Open

feat: Message data classes#284
chrisk314 wants to merge 4 commits into
mainfrom
feat/message-data-classes

Conversation

@chrisk314

@chrisk314 chrisk314 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #102: feat: Base component for external communication (#102).

Plugboard's existing DataReader/DataWriter classes handle chunking, buffering, and field-based IO for file and databasesources, but there was no equivalent for message broker infrastructure. This PR introduces MessageDataReader and MessageDataWriter abstract base classes that provide the same field-based IO pattern for pub/sub messaging — with connection lifecycle management, automatic reconnection with exponential backoff, retry logic, message acknowledgment, and chunked/buffered reads and writes. Three concrete implementations are included: Google Cloud PubSub, AWS SQS/SNS, and Apache Kafka. No cloud infrastructure is provisioned yet; all tests run against mocks and will be iterated against real infrastructure later.

Changes

  • MessageDataReader base class — abstract interface for reading from message brokers with _connect, _disconnect, _receive,
    _convert, _ack methods and built-in retry/reconnection
  • MessageDataWriter base class — abstract interface for writing to message brokers with _connect, _disconnect, _send, _convert
    methods and built-in retry/reconnection
  • GCP PubSub implementation (GCPPubSubDataReader/GCPPubSubDataWriter) using google-cloud-pubsub
  • AWS SQS/SNS implementation (AWSSQSDataReader/AWSSNSDataWriter) using aioboto3
  • Kafka implementation (KafkaDataReader/KafkaDataWriter) using aiokafka
  • Message broker exception hierarchy (MessageBrokerConnectionError, MessageBrokerTransientError, MessageBrokerPermanentError)
  • Settings additions for GCP PubSub, AWS, and Kafka configuration via environment variables
  • Optional dependencies added to pyproject.toml (gcp-pubsub, aws-messaging, kafka)
  • 72 unit tests covering base class behavior, retry logic, connection lifecycle, and all three broker implementations

fsspec license metadata is not detectable by licensecheck, causing
CI failures. Add to ignore list since it's BSD-3-Clause licensed.
Implements issue #102: Base component for external communication via
pub/sub message broker infrastructure.

New base classes:
- MessageDataReader: Abstract base for reading data from message brokers
  with connection management, reconnection with exponential backoff,
  retry logic, message acknowledgment, and chunked/buffered reading.
- MessageDataWriter: Abstract base for writing data to message brokers
  with connection management, reconnection, retry logic, and
  chunked/buffered writing.

Concrete implementations:
- GCPPubSubDataReader/Writer: Google Cloud PubSub
- AWSSQSDataReader/AWSSNSDataWriter: AWS SQS/SNS
- KafkaDataReader/Writer: Apache Kafka

Also includes:
- Message broker exceptions (ConnectionError, TransientError, PermanentError)
- Settings for GCP PubSub, AWS, and Kafka
- Optional dependencies in pyproject.toml
- Proposal document with design rationale
- Comprehensive unit tests (72 new tests)
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Benchmark comparison for fa9a1b92 (base) vs e14a0fae (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     538.2940 (1.0)      550.3755 (1.00)     543.8897 (1.0)      5.3367 (2.22)     545.2340 (1.0)      9.4054 (2.37)          3;0  1.8386 (1.0)           5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         543.6806 (1.01)     549.3609 (1.0)      546.7065 (1.01)     2.4078 (1.0)      545.9489 (1.00)     3.9692 (1.0)           2;0  1.8291 (0.99)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

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