Skip to content
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

Add ScyllaDB Adapter to MoleculerJS #1298

Open
azita-abdollahi opened this issue Aug 24, 2024 · 4 comments
Open

Add ScyllaDB Adapter to MoleculerJS #1298

azita-abdollahi opened this issue Aug 24, 2024 · 4 comments

Comments

@azita-abdollahi
Copy link

Is your feature request related to a problem? Please describe.

I have developed a ScyllaDB adapter for MoleculerJS that allows users to integrate ScyllaDB as a data store in their services. Currently, there is no official adapter for ScyllaDB in the MoleculerJS, which limits options for developers looking to leverage ScyllaDB's high performance and scalability.

Describe the solution you'd like

I would like to propose the addition of my ScyllaDB adapter to the MoleculerJS. This adapter is designed to provide seamless integration with ScyllaDB, enabling developers to utilize its capabilities within their MoleculerJS services. I have followed the standard MoleculerJS contribution guidelines and have written unit tests to ensure the reliability of the adapter.

Describe alternatives you've considered

While there are other databases supported by MoleculerJS, such as MongoDB, there is currently no support for ScyllaDB. Developers looking for a high-performance NoSQL solution may find this adapter beneficial.

Additional context

I am currently using this adapter in my company's production environment, and it has proven to be effective and reliable. My GitHub repository for the ScyllaDB adapter is currently private to protect my code until it is reviewed. However, I am willing to grant access to the maintainers of MoleculerJS for review purposes. Please let me know if you would like me to invite you as collaborators to the repository.

Usage Example

Here’s a simple example of how to use the ScyllaDB adapter in a Moleculer service:

const { ServiceBroker } = require("moleculer");
const DbService = require("moleculer-db");
const ScyllaDbAdapter = require("moleculer-db-adapter-scylla");

const scyllaOptions = {
   contactPoints: ["127.0.0.1"],
   localDataCenter: "datacenter1",
   keyspace: "test",
   authProvider: { username: "cassandra", password: "cassandra" },
   ormOptions: {
       defaultReplicationStrategy: {
           class: 'SimpleStrategy',
           replication_factor: 1
       },
       migration: 'safe'
   }
};

const adapter = new ScyllaDbAdapter(scyllaOptions);
const broker = new ServiceBroker();

broker.createService({
    name: "users",
   mixins: [DbService],
    adapter: adapter,
    actions: {
        // service actions
    }
});

broker.start();

Thank you for considering my contribution to the MoleculerJS ecosystem. I look forward to your feedback!

Best regards,

Azita Abdollahi

https://github.com/azita-abdollahi

@icebob
Copy link
Member

icebob commented Aug 24, 2024

Hi, good job.
If you think, I could look at the service code, but I'm not familiar with Scylla.

I don't plan to put it into the moleculerjs org because if this module will be abandoned I should maintain it without experience of Scylla. So please keep the code under your account, publish to NPM, and send the repo link (in a PR) to the moleculer's awesome repo. After it merged, it will appear in the Modules list of website.

@azita-abdollahi
Copy link
Author

Hi @icebob ,

Thank you for your response and guidance! I would be delighted for you to review my code.

I have made my repository public, and you can check it out here. Additionally, the npm package is available here.

I’m eager to contribute to the Moleculer ecosystem and will be submitting a PR to the Moleculer's Awesome repository soon.

@icebob
Copy link
Member

icebob commented Aug 25, 2024

Hi,

first of all, good job! I've checked the repo and the code is nice and clean, it follows the same code style and quality as other moleculer-db adapters, great!

But some comments:

  1. Please set a correct minimal Node version. Now the package.json contains >=10.x.x but it's wrong, because I tried to run npm test on Node 12 and it crashed because Jest is newer. You don't need to support old Node version, but the package json contains the correct minimal version.
  2. Drop the bluebird. We have just done it in other adapters.
  3. I see many of return await Promise..., but in this case the await has no effect if you return a Promise, so in this case just use return Promise...
  4. Add Github Action CI workflow to run tests.
  5. You use the express-cassandra in adapter, which uses cassandra-driver. The express-cassandra gives any advantages for the adapter? Or can you use the cassandra-driver directly? Because it looks express-cassandra is a heavy package:
    image
    I highlighted the cassandra-driver in the tree, any others is came from express-cassandra. I think worth to check the possibility :)

All in all, it's a good work! 👍

@azita-abdollahi
Copy link
Author

Thank you so much for taking the time to review my code and providing such helpful feedback! I really appreciate your suggestions, and I will implement them in my module.

Regarding the use of express-cassandra, I choose it for its ease of use and built-in features that simplify working with scyllaDB. While it is a larger package, it provides a more straightforward integration, which I found beneficial for this adapter.

Thanks again for your insights!

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

No branches or pull requests

2 participants