-
Notifications
You must be signed in to change notification settings - Fork 348
feat(connectors): add Meilisearch sink connector #3497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
countradooku
wants to merge
11
commits into
apache:master
Choose a base branch
from
countradooku:feat/meilisearch-sink-connector
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2fe5de4
feat(connectors): add Meilisearch sink connector
rdiaconu-spec 7c306ab
fix(connectors): address meilisearch sink review
rdiaconu-spec 16212a6
Merge branch 'master' into feat/meilisearch-sink-connector
countradooku aa8ba69
fix(connectors): address meilisearch sink review feedback
countradooku 0ff5885
Merge branch 'master' into feat/meilisearch-sink-connector
countradooku 4284fe6
fix(connectors): address meilisearch sink follow-up review
countradooku 3a80598
Merge branch 'master' into feat/meilisearch-sink-connector
countradooku 7f43ab3
fix(connectors): harden meilisearch sink retries
countradooku 33841de
fix(connectors): refine meilisearch sink accounting
countradooku 5c68833
Merge branch 'master' into feat/meilisearch-sink-connector
countradooku ae744d1
fix(connectors): warn on meilisearch sink risks
countradooku File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| [package] | ||
| name = "iggy_connector_meilisearch_sink" | ||
| version = "0.4.0" | ||
| description = "Iggy Meilisearch sink connector" | ||
| edition = "2024" | ||
| license = "Apache-2.0" | ||
| keywords = ["iggy", "messaging", "streaming", "search", "meilisearch"] | ||
| categories = ["command-line-utilities", "database", "network-programming"] | ||
| homepage = "https://iggy.apache.org" | ||
| documentation = "https://iggy.apache.org/docs" | ||
| repository = "https://github.com/apache/iggy" | ||
| readme = "../../README.md" | ||
| publish = false | ||
|
|
||
| [lib] | ||
| crate-type = ["cdylib", "lib"] | ||
|
|
||
| [dependencies] | ||
| async-trait = { workspace = true } | ||
| base64 = { workspace = true } | ||
| iggy_common = { workspace = true } | ||
| iggy_connector_sdk = { workspace = true } | ||
| meilisearch-sdk = { workspace = true } | ||
| secrecy = { workspace = true } | ||
| serde = { workspace = true } | ||
| serde_json = { workspace = true } | ||
| simd-json = { workspace = true } | ||
| tokio = { workspace = true } | ||
| tracing = { workspace = true } | ||
| url = { workspace = true } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Meilisearch Sink Connector | ||
|
|
||
| A sink connector that consumes messages from Iggy streams and writes them to a | ||
| Meilisearch index through the official Rust SDK. | ||
|
|
||
| ## Configuration | ||
|
|
||
| - `url`: Meilisearch base URL. Paths, query strings, and fragments are ignored. | ||
| - `index`: Target index UID. | ||
| - `api_key`: Optional Meilisearch API key sent as `Authorization: Bearer`. | ||
| - `primary_key`: Index primary key field. Defaults to `iggy_id`. | ||
| - `document_action`: `replace` uses SDK add-or-replace semantics; `update` uses SDK add-or-update semantics. Defaults to `replace`. | ||
| - `create_index_if_not_exists`: Create the index during `open()` when missing. Defaults to `true`. | ||
| - `include_metadata`: Add Iggy metadata fields to each document. Defaults to `true`. | ||
| - `batch_size`: Maximum documents per Meilisearch document request. Defaults to `1000`. | ||
| - `timeout`: Request timeout as a humantime string, for example `30s`. Defaults to `30s`. | ||
| - `wait_for_tasks`: Poll Meilisearch tasks until terminal state before returning from `consume()`. Defaults to `true`. Setting this to `false` makes document indexing fire-and-forget, so asynchronous Meilisearch task failures are not observed by the connector. | ||
| - `task_timeout`: Maximum time to wait for each Meilisearch task. Defaults to `30s`. | ||
| - `task_poll_interval`: Delay between task polls. Defaults to `100ms`. | ||
| - `max_retries`: Maximum transient retries after the initial request. Defaults to `3`. | ||
| - `retry_delay`: Initial transient retry delay. Defaults to `500ms`. | ||
| - `max_retry_delay`: Maximum transient retry delay. Defaults to `5s`. | ||
| - `max_open_retries`: Maximum transient retries after the initial request while opening the index. Defaults to `5`. This also applies to `get_task` polls while waiting for index creation during `open()`. | ||
|
|
||
| ## Behavior | ||
|
|
||
| JSON object payloads are indexed as documents. JSON arrays or scalar values are | ||
| wrapped in a `value` field because Meilisearch documents must be objects. Raw | ||
| payloads are parsed as JSON when possible; otherwise, they are indexed as base64 | ||
| data. Text payloads are indexed in a `text` field. Unsupported payload schemas | ||
| are skipped with a warning and counted as sink errors, matching the connector | ||
| runtime's per-record drop behavior for malformed records. | ||
|
|
||
| When the configured primary key is absent, the connector injects a stable value | ||
| derived from the exact Iggy stream, topic, partition, offset, and message ID. | ||
| This avoids Meilisearch primary-key inference failures and keeps repeated | ||
| delivery idempotent for the same message. | ||
|
|
||
| When `include_metadata` is enabled, metadata fields are only inserted when the | ||
| document does not already contain those names. Existing user fields are | ||
| preserved. If `primary_key` is set to a field other than `iggy_id`, the | ||
| connector also inserts `iggy_id` as stable Iggy metadata when absent. | ||
|
|
||
| `wait_for_tasks=false` only skips waiting for document indexing tasks during | ||
| `consume()`. In that mode, successful submission lets the runtime commit the | ||
| consumer offset before Meilisearch has confirmed indexing, so later task | ||
| failures are not retried, logged, or counted by this connector. If | ||
| `create_index_if_not_exists=true` and the connector creates the index during | ||
| `open()`, it still waits for that index-creation task so the first batch cannot | ||
| race the index creation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| type = "sink" | ||
| key = "meilisearch" | ||
| enabled = true | ||
| version = 0 | ||
| name = "Meilisearch sink" | ||
| path = "../../target/release/libiggy_connector_meilisearch_sink" | ||
| verbose = false | ||
|
|
||
| [[streams]] | ||
| stream = "test_stream" | ||
| topics = ["test_topic"] | ||
| schema = "json" | ||
| batch_length = 100 | ||
| poll_interval = "5ms" | ||
| consumer_group = "meilisearch_sink_cg" | ||
|
|
||
| [plugin_config] | ||
|
countradooku marked this conversation as resolved.
|
||
| url = "http://localhost:7700" | ||
| index = "iggy_messages" | ||
| primary_key = "iggy_id" | ||
| document_action = "replace" | ||
| create_index_if_not_exists = true | ||
| include_metadata = true | ||
| batch_size = 1000 | ||
| timeout = "30s" | ||
| wait_for_tasks = true | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.