Running the adapter
Prerequisites
-
Java installation (min Java 8)
-
A running local Diffusion server (or server cluster) (min v6.9)
-
A running remote Diffusion server (or server cluster), if publishing to topics to different Diffusion server (min v6.5)
Download the adapter bundle
Download this zip file that contains the adapter jar and other resources.
Run script
The adapter can be started with any of the following:
-
just bootstrap configuration to connect to the local Diffusion server
-
a configuration file
-
With a combination of both
The provided scripts can be used to run the application which runs the executable jar of the Diffusion adapter.
Starting with bootstrap configuration only
To start the adapter with the minimum required bootstrap configuration:
-
Run the
diffusion-adapter-bootstrap.shscript in thebindirectory.
The Diffusion connection details can be updated as needed in the script. By default, it is set to use the connection details of a local Diffusion server.
./bin/diffusion-adapter-bootstrap.sh
| If the adapter is initiated with only the bootstrap configuration, it will establish a session with the Diffusion server. Nevertheless, to fully leverage its functionality, a service needs to be added for data consumption or publication. Therefore, after starting the adapter with the bootstrap configuration, use the Diffusion management console to add a service to begin publishing or consuming data. |
Starting with a configuration file
To start the adapter with a configuration file:
-
Run the
diffusion-adapter.shscript in thebindirectory.
This script uses a sample configuration file, configuration.json, which is located in the example folder. The configuration file contains general Gateway Framework configuration along with configuration that is specific to the Diffusion adapter - contained within the application sections. Modify this file as needed to configure services and sharedConfigs.
./bin/diffusion-adapter.sh
The JSON schema files for service types and sharedConfig type in schema folder can be used to understand the configuration requirements in more detail.
For Windows, use the diffusion-adapter.bat script or diffusion-adapter-bootstrap.bat instead.
.\bin\diffusion-adapter.bat
Run the docker image
To run the docker image:
-
Pull the docker image.
docker pull pushtechnology/diffusion-adapter:1.1.0
-
Run the image as follows:
-
With minimal bootstrap configuration:
docker run \ -e gateway.diffusion.url=ws://90.247.210.62:8080 \ -e gateway.diffusion.principal=admin \ -e gateway.diffusion.password=password \ pushtechnology/diffusion-adapter:1.1.0
-
With a configuration file:
docker run \ --mount type=bind,source=configuration.json,target=/opt/diffusion-adapter/configuration.json \ -e gateway.config.file=/opt/diffusion-adapter/configuration.json \ pushtechnology/diffusion-adapter:1.1.0
-
Here an external config file is mounted in /opt/diffusion-adapter/configuration.json path and is configured as a value for the gateway.config.file environment variable to set the configuration file for the java application.
|
The docker image allows setting the EXTRA_JAVA_OPTIONS environment variable, which
can be set to specify any additional JVM option or override the pre-configured JVM
options for the docker container.
External libraries
Any external JAR files containing payload converters or custom publishers that are not part of the Diffusion adapter can be added to the 'ext' directory available in the Diffusion adapter bundle. The JARs in the 'ext' directory are configured to be loaded during startup by the scripts in the 'bin/' directory.