> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enterspeed.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Service Bus

The Enterspeed Azure Service Bus integration uses [destinations](/enterspeed/reference/js/full-schema/actions#destination) to send data from views directly to a configured Azure Service Bus queue or topic. This means that you can decide on schema level which views you want to send to the service bus.

You will only have to set the destination field on the entity schema you want to send to the Azure Service Bus. All schema references are automatically resolved so you don't have to set it on all referenced schemas.

It's possible to configure multiple Azure Service Bus destinations if you need to push different types of data to different service bus queues or topic.

## Configuration

In order to setup the Azure Service Bus configuration you need the following:

| Setting          | Description                                             |
| ---------------- | ------------------------------------------------------- |
| ConnectionString | The connection string to the Azure Service Bus          |
| QueueOrTopicName | The name of the queue or topic in the Azure Service Bus |

## Message

The message will send the following data.

```json theme={null}
{
  "id": "gid://Environment/2052b78d-6c34-4f11-bea5-296cf2d26968/Source/053b598b-c3d1-46fb-91e3-53115169cdb2/Entity/1234/View/product", // the Enterspeed view id
  "originId": "1234", // the origin id of the entity
  "type": "product", // the type of the entity
  "action": "Deploy", // can have the value of Deploy or Remove
  "url": "https://weu.delivery.enterspeed.com/v2?id=gid://Environment/40bb2d76-3b71-4121-b9b6-238cf4f325c4/Source/9e78f134-cf84-4ec5-9180-0b72b94949be/Entity/1099-en-us/View/home" // the absolute url for the delivery api to fetch the view
}
```

## Example of usage

<Tabs>
  <Tab title="JavaScript">
    ```js title="Content schema with Azure Service Bus destination" theme={null}
    /** @type {Enterspeed.FullSchema} */
    export default {
      triggers: function(context) {
        context.triggers('cms', ['content']);
      },
      actions: function (sourceEntity, context) {
        context.destination('service-bus');
      },
      properties: function ({properties: p, url}, context) {
        return {
          product: {
            url: url,
            title: p.title,
            content: p.text
        }
      }
    }
    ```
  </Tab>

  <Tab title="JSON">
    ```json title="Content schema with Azure Service Bus destination" theme={null}
    {
      "triggers": {
            "cms": ["content"]
        },
      "destinations": [
        {
          "alias": "service-bus"
        }
      ],
      "properties": {
        "url": "{url}",
        "title": "{p.title}",
        "content": "{p.text}"
      }
    }
    ```
  </Tab>
</Tabs>
