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

Testing the connector

PreviousRunning the agentNextIntegrating Sqlite

Last updated 10 months ago

Now that the agent is running - lets test the connector by executing the integration in the model designer.

If you execute the workflow you should get a 'ok' as a reply.

This is because in your agent code, you setup the result to have the value ok

```javascript
return {result:'ok',count:0};
```

So if you see that result, it means the connectivity works!

The next step is receiving inputs.

Lets go back to our agent code inside the processRequest function:

```javascript
async function processRequest(payload) {
    return {result:'ok',count:12};
}
```

Lets change this to receive our payload and parse it and extract the query.

Recall in the step where you defined your connector function, you created a JSON payload like

{"query":"select * from foo;","function":"sqlquery"}

So this is the payload we will be receiving inside the processRequest() function.

Lets parse it and extract the query.

```javascript
async function processRequest(payload) {
    let obj = JSON.parse(payload);
    if (obj.function == 'sqlquery') {
        //TODO: do something
    }
    return {result:'ok',count:12};
}
```

So we can now extract the sql query.

Now we need to actually integrate sqlite and run the query. Lets do that next.