GithubHelp home page GithubHelp logo

Support lua scripting about flashmq HOT 6 CLOSED

halfgaar avatar halfgaar commented on June 4, 2024
Support lua scripting

from flashmq.

Comments (6)

bigsmoke avatar bigsmoke commented on June 4, 2024

As far as I know Wiebe's intentions, a big part of FlashMQ's design philosophy is to have a minimal set of dependencies; another is to do one thing and to do it well. In my opinion, built-in Lua support would add needless complexity and an extra dependency. Though the latter could be configurable at compile-time, that in itself creates more packaging choices and difficulties.

The best approach for those wishing to work with Lua (or any other scripting language for that matter) would be to write a plugin (in C++) that adds support for that language. FlashMQ's plugin ABI is stable, and, since there's not much you can't do with a plugin within FlashMQ's plugin architecture, implementing scripting support shouldn't be hugely difficult.

However … another cornerstone of FlashMQ is performance, and I would venture that in most cases it would be unwise to surrender some of that performance to the drag imposed by an interpreted language.

Then there is the matter of type safety. FlashMQ is written in strongly-typed C++ to make it as fault-free as possible. A quick Google reveals that there are a number of competing approaches to make Lua more strongly type than the baseline language.

All in all, I can't speak for Wiebe, but I think that adding Lua suport to FlashMQ itself would be a mistake. As for a plugin that adds Lua support: I think it can work fine, but would strongly advice to invest that energy in becoming a bit more comfortable in C++. Who doesn't want a non-scripting language on their CV after all?

from flashmq.

bigsmoke avatar bigsmoke commented on June 4, 2024

May I ask, @penguinol, if you have some specific plugin functionality in mind to make you wish you could implent it in Lua?

I'm asking because there are plans for a bunch of example C++ plugins, so that it will be less daunting for novice C++ programmers to build on these examples for most trivial needs, and it will be good to have some concrete needs and wishes in the back of our heads when creating these examples.

from flashmq.

penguinol avatar penguinol commented on June 4, 2024

I'm a C++ programmer, but i don't think everything must be implemented in C++.
A external lua scripting plugin is fine. With lua, we can implement auth with http\reids\sql in less than 100 lines of lua code and no need to worry about dependencies, make file, compiler and so on.
This can make flashmq out of box and easier to use. Not only for C++ programmers, but also for ops and other programmers.
I don't really worry about the performance of lua, something like openresty also works fine. The cost of redis/http/sql query is much higher than lua. If users do care about the performance, they should write c++ plugins, otherwise, lua is enough.
A lua plugin with sql\redis\http\json support can fit most of needs.

from flashmq.

halfgaar avatar halfgaar commented on June 4, 2024

@bigsmoke said it. A plugin for Lua may be good idea just to have, however:

With lua, we can implement auth with http\reids\sql in less than 100 lines of lua code and no need to worry about dependencies, make file, compiler and so on.
This can make flashmq out of box and easier to use. Not only for C++ programmers, but also for ops and other programmers.

I don't really worry about the performance of lua, something like openresty also works fine. The cost of redis/http/sql query is much higher than lua.

I suspect the way this will be implemented would be a blocking/synchronous call. An SQL query can take a few milliseconds easily, which is an eternity in FlashMQ time. You may as well then use other brokers that do support Lua.

For HTTP calls, there is an example plugin for async libcurl to avoid blocking calls, and I suspect that will be impossible to implement with Lua. Or, at least write as technical debt from the start (quick to set up, inflexible/limited later).

from flashmq.

bigsmoke avatar bigsmoke commented on June 4, 2024

@halfgaar , I think you can close this issue?

from flashmq.

halfgaar avatar halfgaar commented on June 4, 2024

@halfgaar , I think you can close this issue?

After some consideration, I agree. I'm all for people developing a lua plugin, but as a core feature, I have to conclude that it's not the most logical feature. FlashMQ's fast, fully async model is too easily undermined with lua.

from flashmq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.