Run Java workers under Portals.
This package bundles the dependency-free Java worker SDK as a prebuilt
portals.jar (compiled for Java 17) and puts it on the worker's
classpath ahead of your own classes — nothing is fetched from Maven.
Compile your handlers against the same jar
(javac -cp "$(mix portals.sdk_path java)" ...), then:
children = [
{Portals.Pool,
Portals.Java.worker_opts(
main: "com.example.RunWorker",
classpath: [Application.app_dir(:my_app, "priv/java/classes")],
name: MyApp.Java,
size: 2
)}
]See the Java guide for a full walkthrough.
Summary
Functions
Absolute path to the bundled portals.jar.
Build Portals.start_worker/1 / Portals.start_pool/1 options for a Java
worker.
Functions
Absolute path to the bundled portals.jar.
Build Portals.start_worker/1 / Portals.start_pool/1 options for a Java
worker.
Options
:main(required) — the fully qualified class whosemainrunsnew Worker()...run(args).:classpath— your own classpath entries (directories or jars), appended afterportals.jar. Defaults to[].:java— thejavalauncher, as a name looked up onPATHor a path. Defaults to"java".:java_args— JVM flags placed before-cp, e.g.["-Xmx512m"].:args— arguments passed tomain. Portals appends the socket path after these, as the last argument.:env— extra{name, value}environment entries; these win over the ones set here.
Every other option is passed through unchanged.