The Random Content Connector

The Connectors SDK comes with a sample connector to help you.

Random Content Connector

The Random Content connector generates a configurable number of documents with random titles and body fields.

Quick start

Note
This quick start assumes that Fusion is installed on the /opt path.
  1. Clone the repo:

git clone https://github.com/lucidworks/connectors-sdk-resources.git
cd connectors-sdk-resources/java-sdk/connectors/
./gradlew assemblePlugins
  1. This produces one zip file, named random-connector-5.0.zip, located in the build/plugins directory. This artifact is now ready to be uploaded directly to Fusion as a connector plugin.

Building

Important

As a first step, change the fusionHome property in the gradle.properties file.

The fusionHome property is the full path of your local Fusion installation. The path should include Fusion’s version.

For example /opt/fusion/4.2.0

The fusionHome is needed to import the code to an IDE.

Random Content Plugin

Build the plugin zip:

./gradlew clean build :assemblePlugin

This produces one zip file, named random-connector.zip, located in the build/libs directory.

At this point, the generated zip could be uploaded directly to Fusion, but follow the steps below to run as a remote plugin.

Start

Connect to Fusion plugin by using the client jar plus the plugin zip:

java  -jar ${fusionHome}/apps/connectors/connectors-rpc/client/connector-plugin-client-${fusionVersion}-uberjar.jar build/plugins/random-content-connector-{version}.zip

Start with debugging enabled:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5010 -jar ${fusionHome}/apps/connectors/connectors-rpc/client/connector-plugin-client-${fusionVersion}-uberjar.jar build/plugins/random-content-connector-{version}.zip

Alternatively, when proper configuration is done in the gradle.properties file (fusionHome, fusionVersion and fusionRpcTarget properties), the plugin can also be run using a simple gradle task:

./gradlew connect

After running this, logging should show that it either was able to connect to Fusion, or not. If not, be sure you’re using the right Fusion address/port. If not, the client jar can accept various related settings.

Fusion

After the client process successfully connects to Fusion, you should see the Random Content Connector available in Fusion as a new connector type.