# OpenFaas

Kubemq OpenFaas target connector allows services using kubemq server to invoke OpensFaas's functions.

## Prerequisites

The following are required to run the OpenFaas target connector:

* kubemq cluster
* OpenFaas platform
* kubemq-targets deployment

## Configuration

OpenFaas target connector configuration properties:

| Properties Key | Required | Description               | Example                    |
| -------------- | -------- | ------------------------- | -------------------------- |
| gateway        | yes      | OpenFaas gateway address  | "<http://localhost:31112>" |
| username       | yes      | OpenFass gateway username | "admin"                    |
| password       | yes      | OpenFaas gateway password | "password"                 |

Example:

```yaml
bindings:
  - name: kubemq-query-OpenFaas
    source:
      kind: kubemq.query
      name: kubemq-query
      properties:
        address: "kubemq-cluster:50000"
        client_id: "kubemq-query-OpenFaas-connector"
        auth_token: ""
        channel: "query.OpenFaas"
        group:   ""
        auto_reconnect: "true"
        reconnect_interval_seconds: "1"
        max_reconnects: "0"
    target:
      kind: serverless.openfaas
      name: target-serverless-openfaas
      properties:
        gateway: "http://localhost:31112"
        username: "admin"
        password: "password"
```

## Usage

### Request

Request metadata setting:

| Metadata Key | Required | Description             | Possible values     |
| ------------ | -------- | ----------------------- | ------------------- |
| topic        | yes      | OpenFaas function topic | "function/nslookup" |

Request data setting:

| Data Key | Required | Description                          | Possible values    |
| -------- | -------- | ------------------------------------ | ------------------ |
| data     | yes      | data to set for the OpenFaas request | base64 bytes array |

Example:

```javascript
{
  "metadata": {
    "topic": "function/nslookup"
  },
 "data": "a3ViZW1xLmlv"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kubemq.io/configuration/connectors/kubemq-targets/standalone/openfaas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
