Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions docs/source/receive-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,48 +89,12 @@ Controller watcher feature, as follows:
func main() {
ctx := signals.NewContext()
ctx = adapter.WithController(ctx, youradapter.NewController)
ctx = adapter.WithConfigMapWatcherEnabled(ctx)
adapter.MainWithContext(ctx, "yourcomponent",
youradapter.NewEnvConfig,
youradapter.NewAdapter)
}
```

The library automatically creates a watcher on the ConfigMap named
`config-yourcomponent`. In order to react to any ConfigMap changes, in your
adapter constructor (`NewAdapter`), you must add a ConfigMap watcher, as
follows:

```go
func NewAdapter(ctx context.Context,
_ adapter.EnvConfigAccessor,
ceClient cloudevents.Client) adapter.Adapter {
youradapter := ...

cmw := adapter.ConfigMapWatcherFromContext(ctx)
cmw.Watch("config-yourcomponent", youradapter.updateFromConfigMap)

return youradapter
}
```

The controller associated to the receive adapter generates the ConfigMap. It
relies on the [persistent store](../../pkg/utils/cache/persisted_store.go)
utility. Add these lines to your controller to enable it.

```go
// Create and start persistent store backed by ConfigMaps
store := eventingcache.NewPersistedStore(
"yourcomponent",
kubeclient.Get(ctx),
system.Namespace(),
"config-yourcomponent",
yourcomponentInformer.Informer(),
yourcomponent.Project)

go store.Run(ctx)
```

## Logging, metrics and tracing

The adapter main code automatically sets up logging, a metrics server,
Expand Down