custom

command
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README ΒΆ

Create custom generator/transform/sink in External Projects

This guide provides detailed instructions on how to create custom generators/transforms/sinks.


πŸ“‚ Step 1: Configure Dependencies

  1. Create a directory named pkl in your project.
  2. Inside the pkl directory, create a file named PklProject with the following content:
dependencies {
  ["pipelaner"] {
    uri = "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@x.x.x"
  }
}

Replace x.x.x with the required version of Pipelaner.


βš™οΈ Step 2: Configure Pipelines

Create a pipeline configuration file (e.g., config.pkl) with the following content:

import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/Pipelaner.pkl"
import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/source/Components.pkl"
import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/source/sink/Sinks.pkl"
import "example.pkl"

pipelines {
  new Components.Pipeline {
    name = "example-pipeline"
    inputs {
      new example.ExampleGenInt {
        name = "example-gen-int"
        count = 10
      }
    }
    transforms {
      new example.ExampleMul {
        name = "example-mul"
        inputs {
          "example-gen-int"
        }
        mul = 2
      }
      new example.ExampleMul {
        threads = 10
        name = "example-mul2"
        inputs {
          "example-mul"
        }
        mul = 5
      }
    }
    sinks {
      new Sinks.Console {
        threads = 10
        name = "console"
        inputs {
          "example-mul2"
        }
      }
    }
  }
}

settings {
  gracefulShutdownDelay = 15.s
  logger {
    logLevel = "info"
  }
  healthCheck {
    enable = false
    host = "127.0.0.1"
    port = 8080
  }
  metrics {
    enable = false
    host = "127.0.0.1"
    port = 8082
  }
}

πŸ›  Step 3: Implement Custom Components

If you need custom components, create an implementation file (e.g., pkl/custom.pkl) with the following content:

@go.Package {name = "gen/custom"}
module pipelaner.source.example

import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.11.1#/go.pkl"
import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/source/input/Inputs.pkl"
import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/source/sink/Sinks.pkl"
import "package://pkg.pkl-lang.org/github.com/pipelane/pipelaner/pipelaner@1.0.0#/source/transform/Transforms.pkl"

class ExampleGenInt extends Inputs.Input {
  fixed sourceName = "example-generator"
  count: Int
}

class ExampleMul extends Transforms.Transform {
  fixed sourceName = "example-mul"
  mul: Int
}

class ExampleConsole extends Sinks.Sink {
  fixed sourceName = "example-console"
}

πŸ”§ Step 4: Generate Code

If custom components were created, generate the required code using the following command:

pkl-gen-go pkl/custom.pkl

πŸš€ Step 5: Implement and Register Components

To use the custom components in your project, implement and register them in the source of Pipelaner. An example implementation can be found in custom.go:

source.RegisterInput("example-generator", &GenInt{})
source.RegisterTransform("example-mul", &TransMul{})

πŸ“œ License

This project is licensed under the Apache 2.0 license.
You are free to use, modify, and distribute the code under the terms of the license.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
gen
custom
Code generated from Pkl module `pipelaner.source.examples.custom`.
Code generated from Pkl module `pipelaner.source.examples.custom`.

Jump to

Keyboard shortcuts

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