Lucy Training
  • Introduction
  • Reference Material
  • What is Lucy
  • How to use this training site
  • The Lucy Pro Interface
  • Getting familiar with the model designer
  • The Property Panel
  • Working with Data Collections
  • Debugging Integrations
  • Editing Tools
  • Loops and list processing
  • Using Javascript
  • Publishing APIs
  • Utility Blocks
  • Model Settings
  • Calling Actions
  • Connecting to Webservices
  • Working with time series data
  • Creating visualizations
  • Creating On-Premise Connectors
    • On-Premise Connector Concepts
    • Using the On-Premise Connector SDK
    • Building our first connector
    • Connector Functions
    • Defining a function
    • Creating the agent
    • Setting up the integration
    • Running the agent
    • Testing the connector
    • Integrating Sqlite
    • Understanding the structure of the connector
    • Monitoring your connector
  • Next Steps
Powered by GitBook
On this page
  1. Creating On-Premise Connectors

Understanding the structure of the connector

Now that we have the connector up and running - lets see the different parts of the code and how it works.

There are two important bits that every connector has:

processRequest()

This function is responsible for receiving the payload from Lucy, executing it and returning a result. It's an async function so make sure you use Promises and async/await in order to make the connector efficient.

The other important bit is the last bit at the bottom:

```javascript
const connector = LucyConnector.fromInstallationKey(process.env.LUCY_CONNECTOR_KEY,ConnectorName,processRequest);
connector.init().then(()=>{

    console.log('Connector initialized');
});
```

This code initializes the connector using the installation key as previously mentioned.

Its loading it from an environment variable and creating the connector.

Next, we call the init() function in order to begin the purpose of establishing server connectivity.

When the init() promise resolves, we are good to go.

PreviousIntegrating SqliteNextMonitoring your connector

Last updated 10 months ago