# EventingSubscriberRegistrationContext

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.3.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface EventingSubscriberRegistrationContext {
  readonly cancellationToken: cancellationToken;
  readonly executionContext: DistributedApplicationExecutionContext;
  onAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise<void>): DistributedApplicationEventSubscription;
  onBeforeStart(callback: (arg: BeforeStartEvent) => Promise<void>): DistributedApplicationEventSubscription;
}
```

## Properties

- `cancellationToken`: `cancellationToken` `get` -- Gets the CancellationToken property
- `executionContext`: [DistributedApplicationExecutionContext](/reference/api/typescript/aspire.hosting/distributedapplicationexecutioncontext.md) `get` -- Gets the ExecutionContext property

## Methods

- [onAfterResourcesCreated](/reference/api/typescript/aspire.hosting/eventingsubscriberregistrationcontext/onafterresourcescreated.md) -- `method` -- Subscribes an eventing subscriber to the AfterResourcesCreated event
    ```typescript
  onAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise<void>): DistributedApplicationEventSubscription
  ```
- [onBeforeStart](/reference/api/typescript/aspire.hosting/eventingsubscriberregistrationcontext/onbeforestart.md) -- `method` -- Subscribes an eventing subscriber to the BeforeStart event
    ```typescript
  onBeforeStart(callback: (arg: BeforeStartEvent) => Promise<void>): DistributedApplicationEventSubscription
  ```
