Closed ahmed-adly-khalil closed 1 year ago
Hi @ahmed-adly-khalil,
Thanks a lot for your feedback, I'm glad you like the connector!
Regarding your question: I built the connector with the intent of simply sinking the data from MongoDB to NATS, but I think it would be quite cool to make it bidirectional (sourcing data from NATS to MongoDB). In fact, another user already proposed something similar.
Contributions are welcome! But since supporting bidirectional communication between NATS and MongoDB is not trivial, I invite you to share how you would implement that, and maybe discuss the approach together, before submitting a PR.
@damianiandrea Sounds good, what i had in mind is to use JetStream durable consumers https://docs.nats.io/nats-concepts/jetstream#consumers that can be created via yaml config to watch specific streams and sync data to mongodb, maybe that can happen in the client package of the connector
@ahmed-adly-khalil, thanks for the feedback. I like your idea.
I was thinking of a configuration of this kind:
connector:
# collections: collections to be watched, change events are published to a NATS stream (MongoDB -> NATS)
# - ...
streams: # streams to be consumed, messages are inserted in a MongoDB collection (NATS -> MongoDB)
- streamName: "STREAM_NAME"
subjects:
- "subject1"
# - add more subjects here...
dbName: "db_name"
collName: "coll_name"
This would offer the most basic functionality: stream message -> collection.
A few points to consider (more will probably come up as we brainstorm):
Just thinking out loud. Let me know what you think!
@damianiandrea these are great points, i love the config structure, let me draft a small pr and let's see how it goes, no worries if you tear it down,
Hi, @ahmed-adly-khalil!
Forgive me for the very late response, life got in the way! :)
I think for now I'll close this issue, I'd like to focus on the current functionality of the connector, add more tests, measure its performance, and see what could be improved. After the current implementation is solid and works well, I might come back to this and pick up where we left off!
Thanks a lot for the feedback you gave so far!
Hello, This is really neat work, did you think about the other way around? means syncing messages from NATS/JetStream to Mongodb so that the connector becomes bi-directional similar to what ClickHouse have: https://clickhouse.com/docs/en/engines/table-engines/integrations/nats#table_engine-redisstreams-creating-a-table?
If contribution is open, i can start and submit a PR..