# Azure Service Bus

{% hint style="info" %}
The following documentation is for **Azure Service Bus v1.3.4** *(BDK)*.
{% endhint %}

## Overview

Azure Service Bus provides reliable cloud messaging as a service (MaaS) and simple hybrid integration. This integration enables automated message queuing, publish-subscribe messaging, and enterprise messaging workflows. Enhance application reliability and enable scalable communication between distributed applications and services.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **Azure Service Bus**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### Connect using Connection String

Connect to Azure Service Bus using connection string parameters.

| Label             | Description                                         | Type        |
| ----------------- | --------------------------------------------------- | ----------- |
| Connection String | The connection string for the Service Bus namespace | `sensitive` |

## Procedures

### to receive a (message) from a queue

Get the latest message from an Azure Service Bus queue.

**Input Concepts**

| Concept         | Description                                   | Type     | Required | Default Value |
| --------------- | --------------------------------------------- | -------- | -------- | ------------- |
| `queue name`    | The name of the Azure Service Bus queue       | `text`   | Yes      | (no default)  |
| `max wait time` | Maximum time to wait for a message in seconds | `number` | No       | (no default)  |

**Output Concepts**

| Concept   | Description                                | Type   |
| --------- | ------------------------------------------ | ------ |
| `message` | The latest message received from the queue | `text` |

**Examples**

Receive a message from Azure Service Bus queue

```generic
receive a message from a queue with
    the queue name is "myqueue"
```

Receive a message from Azure Service Bus queue with a maximum wait time of 60 seconds

```generic
receive a message from a queue with
    the queue name is "myqueue"
    the max wait time is 60
```

### to send a message to a queue

Send a message to an Azure Service Bus queue.

**Input Concepts**

| Concept      | Description                             | Type   | Required | Default Value |
| ------------ | --------------------------------------- | ------ | -------- | ------------- |
| `message`    | The message to be sent                  | `text` | Yes      | (no default)  |
| `queue name` | The name of the Azure Service Bus queue | `text` | Yes      | (no default)  |

**Examples**

Send a message to an Azure Service Bus queue

```generic
send "Hello, World!" to a queue with
    the queue name is "myqueue"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kognitos.com/legacy/legacy-experience/books/reference/azureservicebus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
