# AzureServiceBusTopicResource

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

Represents a Service Bus Topic. Initializes a new instance of the {@ats-ref type:AzureServiceBusTopicResource} class.

## Definition

```typescript
interface AzureServiceBusTopicResource
  extends IExpressionValue,
    IManifestExpressionProvider,
    IResource,
    IResourceWithConnectionString,
    IResourceWithParent,
    AzureServiceBusResource]],
    IValueProvider,
    IValueWithReferences,
    IResourceWithAzureFunctionsConfig {
  readonly connectionStringExpression: ReferenceExpression;
  defaultMessageTimeToLive: timespan;
  duplicateDetectionHistoryTimeWindow: timespan;
  readonly parent: AzureServiceBusResource;
  requiresDuplicateDetection: boolean;
  topicName: string;
  addServiceBusSubscription(
      name: string,
      subscriptionName?: string): AzureServiceBusSubscriptionResource;
  withProperties(configure: (obj: AzureServiceBusTopicResource) => Promise<void>): AzureServiceBusTopicResource;
}
```

## Properties

- `connectionStringExpression`: `ReferenceExpression` `get` -- Gets the connection string expression for the Azure Service Bus Topic.
- `defaultMessageTimeToLive`: `timespan` `get - set` -- ISO 8601 default message timespan to live value. This is the duration after which the message expires, starting from when the message is sent to Service Bus. This is the default value used when TimeToLive is not set on a message itself.
- `duplicateDetectionHistoryTimeWindow`: `timespan` `get - set` -- ISO 8601 timeSpan structure that defines the duration of the duplicate detection history. The default value is 10 minutes.
- `parent`: [AzureServiceBusResource](/reference/api/typescript/aspire.hosting.azure.servicebus/azureservicebusresource.md) `get` -- Gets the parent Azure Service Bus resource.
- `requiresDuplicateDetection`: `boolean` `get - set` -- A value indicating if this topic requires duplicate detection.
- `topicName`: `string` `get - set` -- The topic name.

## Methods

- [addServiceBusSubscription](/reference/api/typescript/aspire.hosting.azure.servicebus/azureservicebustopicresource/addservicebussubscription.md) -- `method` -- Adds an Azure Service Bus Subscription resource to the application model.
    ```typescript
  addServiceBusSubscription(name: string, subscriptionName?: string): AzureServiceBusSubscriptionResource
  ```
- [withProperties](/reference/api/typescript/aspire.hosting.azure.servicebus/azureservicebustopicresource/withproperties.md) -- `method` -- Allows setting the properties of an Azure Service Bus Topic resource.
    ```typescript
  withProperties(configure: (obj: AzureServiceBusTopicResource) => Promise<void>): AzureServiceBusTopicResource
  ```
