Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarilabs/jsr223-powerfx
A JSR-223 implementation for evaluating Power Fx formulas (expression) by making use of a server implemented on F# and .NET platform
https://github.com/tarilabs/jsr223-powerfx
fsharp java jsr223 powerfx
Last synced: about 1 month ago
JSON representation
A JSR-223 implementation for evaluating Power Fx formulas (expression) by making use of a server implemented on F# and .NET platform
- Host: GitHub
- URL: https://github.com/tarilabs/jsr223-powerfx
- Owner: tarilabs
- License: apache-2.0
- Created: 2022-03-12T22:38:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-03-23T21:06:46.000Z (over 2 years ago)
- Last Synced: 2024-10-04T09:56:25.115Z (about 2 months ago)
- Topics: fsharp, java, jsr223, powerfx
- Language: Java
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is an Open Source community project.
# JSR-223 Power Fx
A JSR-223 implementation for evaluating Power Fx formulas (expression) by making use of a server implemented on F# and .NET platform.
```mermaid
sequenceDiagram
participant J as Your Java App
participant I as <>
JDK JSR-223
participant E as This JSR-223
ScriptEngine
participant S as This .NET server
(Docker image)
link I: Guide @ https://docs.oracle.com/en/java/javase/14/scripting/java-scripting-api.html
link I: JavaDoc @ https://docs.oracle.com/en/java/javase/17/docs/api/java.scripting/javax/script/package-summary.html
J->>I:
I->>E:
E->>S: POST /eval
(JSON)
S-->>E: Power Fx eval result
(JSON)
E->>I:
I->>J:
```
# How to useRun docker image with:
```bash
docker run -p 80:5000 jsr223-powerfx-server
```Include this dependency in your Java project.
Using Maven:
```xml
com.matteomortari
jsr223-powerfx
0.1
runtime```
Example usage:
```java
ScriptEngineManager MANAGER = new ScriptEngineManager();
ScriptEngine engine = MANAGER.getEngineByName("powerfx");
Bindings bindings = engine.createBindings();
bindings.put("a", 1);
bindings.put("b", 2);
Object result = engine.eval("a+b", bindings); // result = 3
```# FAQ
Q: Why F# ?
A: No particular reason, I've always been looking for an excuse to experiment using it; luck is being prepared when the opportunity comes :)Q: Is it "production-ready"?
A: This is a [chabuduo](https://youtube.com/clip/UgkxeVe0fr81gBBZXzQ1LG2189Z1QrYspmXt) MVP working-PoCQ: I have a feedback/question?
A: Feel free to contact me!# References
Helpful references I've used while building this experiment
- Wu, C. (2010). Dynamic Languages on JVM. In: Pro DLR in .NET 4. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-3067-0_12
- https://github.com/microsoft/power-fx-host-samples/issues/10
- Web Development with F# on .NET Core https://www.youtube.com/watch?v=W8qAUJIVj8c
- https://www.codesuji.com/2020/03/08/F-and-Docker/
- https://docs.microsoft.com/en-us/dotnet/core/docker/build-container?tabs=linux
- https://stackoverflow.com/a/60132230/893991