benthos-arangodb

module
v0.0.0-...-95f7d39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: MIT

README

Benthos ArangoDB Plugin

Interact with ArangoDB in Benthos pipelines

Build

Add this dependency to your project

go get github.com/boorad/benthos-arangodb

Author a main file that calls service.Run() and imports this plugin

package main

import (
	"github.com/benthosdev/benthos/v4/public/service"

	// Import all standard Benthos components
	_ "github.com/benthosdev/benthos/v4/public/components/all"

	// Add this plugin package here
	_ "github.com/boorad/benthos-arangodb"
)

func main() {
	service.RunCLI(context.Background())
}

Finally, build your custom main function:

go build

Alternatively build it as a Docker image with:

go mod vendor
docker build . -t benthos-arangodb

Configuration Examples

Create vertex documents in a collection named for the value in this.objects:

arangodb:
  url: ${ARANGODB_URL}
  username: ${ARANGODB_USERNAME}
  password: ${ARANGODB_PASSWORD}
  database: ${ARANGODB_DATABASE}
  collection_map: |
    root = this.objects
  operation: create
  params:
    overwrite: true

Create edge documents in edges collection:

mapping: |
  root = {
    "_key":  "123",
    "_from": "systems/benthos",
    "_to":   "systems/arangodb",
    "plugin_type":  "processor"
  }

arangodb:
  url: ${ARANGODB_URL}
  username: ${ARANGODB_USERNAME}
  password: ${ARANGODB_PASSWORD}
  database: ${ARANGODB_DATABASE}
  collection: edges
  operation: create
  params:
    overwrite: true

Query via AQL:

arangodb:
  url: ${ARANGODB_URL}
  username: ${ARANGODB_USERNAME}
  password: ${ARANGODB_PASSWORD}
  database: ${ARANGODB_DATABASE}
  operation: query
  query:
    aql: |
      FOR s IN systems
        FILTER s.type IN @types
        RETURN s
    vars_map: |
      root.types = ["input", "processor", "output"]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL