# HandlerConfig

Handler configuration construct for onPublish and onSubscribe.

- Source: [`aws-appsync/lib/channel-namespace.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-appsync/lib/channel-namespace.ts#L66)
- Type last changed: v2.193.0 · 30 Apr 2025

## Example

```ts
declare const api: appsync.EventApi;
declare const ddbDataSource: appsync.AppSyncDynamoDbDataSource;
declare const ebDataSource: appsync.AppSyncEventBridgeDataSource;

// DynamoDB data source for publish handler
api.addChannelNamespace('ddb-eb-ns', {
  code: appsync.Code.fromInline('/* event handler code here.*/'),
  publishHandlerConfig: {
    dataSource: ddbDataSource,
  },
  subscribeHandlerConfig: {
    dataSource: ebDataSource,
  },
});
```

## Properties

- `dataSource`: [AppSyncBackedDataSource](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AppSyncBackedDataSource.html) — The Event Handler data source.

  **Default:** no data source is used

- `direct`: boolean = false — If the Event Handler should invoke the data source directly.

- `lambdaInvokeType`: [LambdaInvokeType](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.LambdaInvokeType.html) — The Lambda invocation type for direct integrations.

  **Default:** LambdaInvokeType.REQUEST_RESPONSE
