Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by
edited by

Hi, I am asking if there is a best practice for plugin system for Clojure application.

Here plugin system means a structure or protocol for third party to write clojure code that is to be loaded as plugin by a Clojure application and there is no need to recompile the application.

An example use case is that a clojure application is designed to load and transform certain data set. It should allow third party to write plugins that could be loaded into the transformation pipeline by deploying the code to certain folder. The application doesn't need to be recompiled.

Is there a best practice to do so?

Hopefully it is clojure way instead of Java way.

Thanks in advance.

1 Answer

+1 vote
by
edited by

You may put the "plugin" (jar) on the classpath, resolve a symbol that indicates a function provided by the "plugin", and give it a call.

Inasmuch as you need not compile Clojure anyway, there is no need to "recompile".

(Edit: Also require the namespace of the function, to get Clojure to load the function, before you can resolve the symbol.)

by
Sounds great. Thanks.
...