Repository navigation
Fixes #28152: Add NATS JetStream Messaging Connector - #28153
rafaelmgrecco wants to merge 29 commits into
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
hi @rafaelmgrecco thanks for the contribution |
|
|
|
…ing schemaKvBucket
|
|
|
|
This PR has had no activity for 30 days and will be closed in 7 days if no further activity occurs. |
# Conflicts: # ingestion/.basedpyright/baseline.json # openmetadata-ui/src/main/resources/ui/src/generated/api/automations/createWorkflow.ts # openmetadata-ui/src/main/resources/ui/src/generated/api/services/ingestionPipelines/createIngestionPipeline.ts # openmetadata-ui/src/main/resources/ui/src/generated/entity/automations/testServiceConnection.ts # openmetadata-ui/src/main/resources/ui/src/generated/entity/automations/workflow.ts # openmetadata-ui/src/main/resources/ui/src/generated/entity/services/connections/serviceConnection.ts # openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/ingestionPipeline.ts # openmetadata-ui/src/main/resources/ui/src/generated/entity/services/ingestionPipelines/serviceProgressEvent.ts # openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/testSuitePipeline.ts # openmetadata-ui/src/main/resources/ui/src/generated/metadataIngestion/workflow.ts
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
@harshach Sorry, I got involved with a project at work, but I've already resolved the existing conflicts. Is there anything else needed to perform the merge? |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
@harshach If you need anything else, just let me know. |
|
@rafaelmgrecco need all of these checks passing. If there are nay changes in your PR affecting these, please fix them. |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 13 resolved / 13 findingsAdds the new NATS JetStream messaging connector with comprehensive unit and integration tests, schema auto-detection, and UI integration. Additive feature with all previous findings successfully addressed. ✅ 13 resolved✅ Bug: TLS config uses non-existent nats-py parameters
✅ Bug: nkeys_seed expects a file path, not raw bytes
✅ Edge Case: Missing newline at end of natsConnection.json
✅ Security: additionalConfig can override auth/TLS connection options
✅ Edge Case: _detect_schema_type falsely classifies text containing 'message ' as Protobuf
...and 8 more resolved from earlier reviews OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
❌ UI Checkstyle Failed❌ Licence HeaderOne or more files are missing or have an outdated Apache 2.0 licence header. Affected files
🔍 ESLint findings in this PR's files — 0 error(s), 15 warning(s)Errors block the build. Warnings do not yet — they are rules whose backlog is still 0 error(s), 15 warning(s) across 1 changed file(s).
All findings
Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
|
|
Working on merging this PR |
|
@rafaelmgrecco I cherry-picked your code into a branch and fixed rest of the comments. Thanks for the contribution. Its in main now. |



Describe your changes:
FIxes: #28152
Adds a new NATS JetStream connector for the Messaging service type.
NATS is a high-performance open-source messaging system. This connector ingests JetStream streams as OpenMetadata Topics, including stream configuration metadata, schema definitions, and sample data — without depending on any Kafka/Confluent ecosystem component.
What was built:
Python connector (
ingestion/src/metadata/ingestion/source/messaging/nats/):connection.py— async NATS client with TLS cert management and event loop handlingmetadata.py—NatsSourceextendingMessagingServiceSource; paginates the JetStream stream list and maps stream config/state to OpenMetadata Topic fieldsmodels.py— Pydantic v2 models for JetStream stream config and stateservice_spec.py— service spec registrationSchema-native schema ingestion — instead of Confluent Schema Registry, schemas are fetched from a JetStream KV bucket. The connector auto-detects the format (Avro JSON, JSON Schema, or Protobuf
.prototext) from the stored value.Authentication support: basic auth (username/password), token, NKey seed, and TLS mutual auth.
JSON Schema (
openmetadata-spec/.../natsConnection.json) with all connection properties.Test connection steps:
GetTopics(validates JetStream access) andCheckSchemaKvBucket(optional, validates schema bucket).UI integration: connection form schema, service icon, in-app field documentation (
Nats.md),MessagingServiceUtils.tscase,ServiceIconUtils.tsentry.Workflow example:
ingestion/src/metadata/examples/workflows/nats.yaml.Tests: 66 unit tests covering connection options, topic listing/pagination, schema type detection, sample data fetching, and error handling. Integration tests with
testcontainersspinning up a real NATS server.Supported metadata:
$JS.API.STREAM.NAMES+$JS.API.STREAM.INFO.*$JS.API.STREAM.MSG.GET.*(last N messages)/jsz?stream=...)Type of change:
Checklist:
Greptile Summary
This PR adds a new NATS JetStream messaging connector that ingests JetStream streams as OpenMetadata Topics, with support for schema detection from a KV bucket, sample data fetching, and four authentication methods (basic, token, NKey, TLS mutual auth).
connection.py,metadata.py,models.py,service_spec.py) with paginated stream listing, nanosecond-to-millisecond retention conversion, and schema auto-detection (Avro / JSON Schema / Protobuf) from a configurable JetStream KV bucket.natsConnection.jsonspec, generated TypeScript types, lazy-loaded connection form schema, service icon, and in-app field docs — all following the existing connector patterns.testcontainerswith a pinnednats:2.10image.Confidence Score: 5/5
Safe to merge; the new connector is fully additive with no impact on existing connectors or data.
The connector introduces a new service type without touching any shared code paths. The resource-management concern flagged in a prior review round has been addressed in the current code with a proper try/except/cleanup block in get_connection. The only remaining item is a dead constant (_JS_PAGE_SIZE) that has no runtime impact.
No files require special attention; the unused page-size constant in metadata.py is the only loose end.
Important Files Changed
_JS_PAGE_SIZEconstant is defined but never included in the pagination request payload.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant W as MetadataWorkflow participant NS as NatsSource participant NC as NatsClient participant JS as NATS JetStream API participant KV as KV Bucket (schemas) participant OM as OpenMetadata W->>NS: get_topic_list() loop Paginate streams NS->>NC: "request($JS.API.STREAM.NAMES, {offset})" NC->>JS: NATS request JS-->>NC: "{streams: [...], total: N}" NC-->>NS: parsed dict NS->>NC: "request($JS.API.STREAM.INFO.{name})" NC->>JS: NATS request JS-->>NC: "{config, state}" NC-->>NS: BrokerTopicDetails end W->>NS: yield_topic(details) NS->>NC: "request($JS.API.STREAM.MSG.GET.KV_{bucket})" NC->>KV: fetch schema key KV-->>NC: base64-encoded schema text NC-->>NS: schema text NS->>NS: _detect_schema_type() NS-->>W: Either[CreateTopicRequest] W->>OM: upsert Topic W->>NS: yield_topic_sample_data(details) loop Last N messages NS->>NC: "request($JS.API.STREAM.MSG.GET.{name}, {seq})" NC->>JS: NATS request JS-->>NC: base64 message data NC-->>NS: decoded message end NS-->>W: Either[OMetaTopicSampleData] W->>OM: upsert sample data%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant W as MetadataWorkflow participant NS as NatsSource participant NC as NatsClient participant JS as NATS JetStream API participant KV as KV Bucket (schemas) participant OM as OpenMetadata W->>NS: get_topic_list() loop Paginate streams NS->>NC: "request($JS.API.STREAM.NAMES, {offset})" NC->>JS: NATS request JS-->>NC: "{streams: [...], total: N}" NC-->>NS: parsed dict NS->>NC: "request($JS.API.STREAM.INFO.{name})" NC->>JS: NATS request JS-->>NC: "{config, state}" NC-->>NS: BrokerTopicDetails end W->>NS: yield_topic(details) NS->>NC: "request($JS.API.STREAM.MSG.GET.KV_{bucket})" NC->>KV: fetch schema key KV-->>NC: base64-encoded schema text NC-->>NS: schema text NS->>NS: _detect_schema_type() NS-->>W: Either[CreateTopicRequest] W->>OM: upsert Topic W->>NS: yield_topic_sample_data(details) loop Last N messages NS->>NC: "request($JS.API.STREAM.MSG.GET.{name}, {seq})" NC->>JS: NATS request JS-->>NC: base64 message data NC-->>NS: decoded message end NS-->>W: Either[OMetaTopicSampleData] W->>OM: upsert sample dataReviews (8): Last reviewed commit: "Update generated TypeScript types" | Re-trigger Greptile