Skip to main content

Setting Java Options for Outbound Connectors

The Java options are passed to the connectors by setting the JAVA_OPTS environment variable. The JAVA_OPTS environment variable is set differently for connectors running as systemd services and for connectors running as non-systemd Docker instances.

Procedure for connector running as systemd service

Create a systemd override file

The following command creates a systemd override file for the connector.

sudo systemctl edit <connector-name>

connector-name: The name of the connector for which you want to create an override file. Possible values aerospike-jms-inbound, aerospike-jms-outbound, aerospike-kafka-outbound, aerospike-pulsar-outbound, aerospike-pubsub-outbound, aerospike-xdr-proxy.

Set the JAVA_OPTS environment variable in the override file

In the override file that you created in the previous step, set the JAVA_OPTS environment variable in the Service section. Here is an example that sets a netty workdir and Java maximum heap size:

Environment=JAVA_OPTS="-Dio.netty.native.workdir=/connector/tmp -Xmx1024m"

Reload the systemd manager configuration

Run the systemd command to reload the manager configuration:

sudo systemctl daemon-reload

Restart connector

Restart the systemd connector service.

sudo systemctl restart <connector-name>

Procedure for Docker (non systemd)

In a non-systemd environment the JAVA_OPTS environment variable should be explicitly set.

For docker this would take the form of adding -e "JAVA_OPTS=<list of java options>" to the exec. All connectors use the same method for example in esp the docker command line might be:

docker run  --name=example-connector -p 8080:8080 -e "JAVA_OPTS=-Dio.netty.native.workdir=/connector/tmp -Xmx8G" aerospike/aerospike-esp-outbound:2.0.0

Like the above examples, this sets a Netty workdir and Java maximum heap size but it could be any Java option.

To verify that this was set correctly you can check in docker with docker top example-connector and you should see the connector running with your java options.