feat(gateways): Iggy Kafka bridge core — SDK client and stream/topic mapping - #4043
ryerraguntla wants to merge 39 commits into
Conversation
…ays)/3533-iggy-bridge-core
|
/author |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4043 +/- ##
============================================
- Coverage 87.47% 87.47% -0.01%
- Complexity 1575 1576 +1
============================================
Files 1280 1280
Lines 222999 222999
Branches 186362 186363 +1
============================================
- Hits 195068 195059 -9
+ Misses 23238 23215 -23
- Partials 4693 4725 +32
🚀 New features to boost your workflow:
|
|
please dont include #PR_NUMBER in PR title because it'd look weird after merge, e.g. |
…om/ryerraguntla/iggy into feat(gateways)/3533-iggy-bridge-core
|
@krishvishal - I am back from my travel and ready with PR #4043 for the Kafka gateway. |
|
Please review |
|
@ryerraguntla I'll review it. |
There was a problem hiding this comment.
Reviewed the bridge module in depth against the SDK, server and CI config it depends on. The work is careful, and several comments caught real, non-obvious hazards: numeric identifiers, the connection-string @/: split, the WebSocket port collision. The recurring problem in the criticals is that comments claim more than the code delivers; four of the six are a correct observation generalized one step too far.
|
/ready |
with iggy servers env params
…om/ryerraguntla/iggy into feat(gateways)/3533-iggy-bridge-core
krishvishal
left a comment
There was a problem hiding this comment.
Requesting changes. Eight things I would fix before this merges, plus a pile of nits inline.
The three that actually bite today: the gateway's own Iggy login failure comes back to the Kafka client as TOPIC_AUTHORIZATION_FAILED (29), which is fatal and blames the client's own ACLs; every bridge method except connect dials with no deadline, so a black-holed Iggy address parks the call for the kernel SYN-retry window; and a padded topic-map key like [topics." orders "] loads clean and then silently routes that topic to the default stream. The other five are public API shapes that #3535, #3536 and #3537 will inherit, so they are much cheaper to fix here than across four PRs.
Nothing calls the bridge module yet, which is why most of the error-code stuff below is a nit rather than a blocker. Worth landing before the handlers do though.
Reviewed against the Apache Kafka tree for the protocol claims (Errors.java, the exception hierarchy, and the request/response schemas).
|
/ready |
There was a problem hiding this comment.
Second pass. Almost none of this overlaps the last round, because most of it is what the fixes to the last round brought in: with_request_timeout on every call, the batch high_watermarks, the mapping-key check, the port band, the delete-and-recreate test.
Nothing here is fatal today, since no handler reaches the bridge yet, but the timeout helper and the high_watermarks signature are the two that get expensive once #3535, #3536 and #3537 are built on top of them.
|
/ready |
Summary
Rationale
Phase 1 of the Kafka → Iggy bridge rollout needs a shared
IggyBridgeso later API handlers (#3535 Produce, #3536 Fetch, #3537 ListOffsets) talk to Iggy through one client, one topic map, and one error map.#3421 landed wire framing + stub responses with no Iggy backend. This PR lands Layer 3 (
gateways/kafka/src/bridge/) as a library: connect, map, provision, watermark, Kafka error codes. Produce/Fetch/ListOffsets dispatch still stubs. Wiring is the follow-on issues, not this one.What changed?
New module under
iggy-gateway-kafka:IggyBridge::connect/closeinsrc/bridge/iggy_bridge.rsensure_stream_and_topic(kafka_topic, partition_count)src/bridge/topic_map.rs+IggyBridgeConfig::from_envSecretStringcredentialssrc/bridge/config.rs(IGGY_KAFKA_IGGY_*)IggyBridge::high_watermark(see signature note)BridgeError::to_kafka_error_codeinsrc/bridge/error.rstests/bridge_iggy_integration_tests.rsLimits and Future PRs (still #3533 out of scope)
high_watermark→ Kafka gateway: Kafka ListOffsets API (key 2) — earliest/latest via Iggy high watermark #3537IggyBridgeConfig::from_envis implemented and env-allowlisted inmain.rs, butmaindoes not callIggyBridge::connectyet. Live Kafka handlers still stubs.IggyBridge::connectreturnsErr, not a panic. No Kafka handler calls the bridge yet.Mapping / config (README)
Default: Kafka topic
orders→ Iggy streamIGGY_KAFKA_IGGY_STREAM(defaultkafka), topicorders.Overrides: TOML via
IGGY_KAFKA_TOPIC_MAP_PATH. Filedefault_streamwins over the env var when both set.Credentials: fluent TCP builder +
SecretString, notiggy://user:pass@host(that URI splits on@/:).ensure_stream_and_topicusesIdentifier::namedso all-digit Kafka names (2024) stay names, not numeric Iggy IDs.Existing topic with a different
partition_count→BridgeError::PartitionCountMismatch→ KafkaINVALID_PARTITIONS(37).Error map
UNKNOWN_TOPIC_OR_PARTITION(3)TOPIC_AUTHORIZATION_FAILED(29)NOT_LEADER_OR_FOLLOWER(6), retriableINVALID_PARTITIONS(37)UNKNOWN_SERVER_ERROR(-1)Acceptance criteria (#3533)
tests/bridge_iggy_integration_tests.rs(realiggy-serverharness, not a mock)ensure_stream_and_topicidempotent on repeated calls (incl. numeric topic name2024)IGGY_KAFKA_*config (gateways/kafka/README.md)Also covered beyond the issue checkbox list: high-watermark empty vs 3 produces; special password
p@ss:word; connect to an unbound port returnsErr.Out of scope (issue)
docs/BRIDGE_MAPPING.md(partition / group mapping) — still open onSCOPE.md, not this issueTest plan