# Read

Required Frends version: 5.5+

Required .NET version: 6.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.RabbitMQ>

{% tabs %}
{% tab title="Parameter: Connection" %}

| Name                                                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ReadMessageCount : `Int32`                            | <p>Maximum number of messages to read.</p><p><br>Default: <code>1</code><br>Example: <code>1</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| AckType : `AckType`                                   | <p>Set the acknowledgement type.</p><p>Possible values:</p><ul><li><code>NoAck</code>:</li></ul><p>Set the acknowledgement type.</p><ul><li><code>AutoAck</code>:</li></ul><p>Set the acknowledgement type.</p><ul><li><code>AutoNack</code>:</li></ul><p>Set the acknowledgement type.</p><ul><li><code>AutoNackAndRequeue</code>:</li></ul><p>Set the acknowledgement type.</p><ul><li><code>AutoReject</code>:</li></ul><p>Set the acknowledgement type.</p><ul><li><code>AutoRejectAndRequeue</code>:</li></ul><p>Set the acknowledgement type.</p><p><br>Default: <code>1</code><br>Example: <code>AutoAck</code></p>                                                                                                                                                                                                                                                                                    |
| AuthenticationMethod : `AuthenticationMethod`         | <p>Authentication method: URI, hostname with username/password, or certificate.</p><p>Possible values:</p><ul><li><code>URI</code>:</li></ul><p>Authentication method: URI, hostname with username/password, or certificate.</p><ul><li><code>Host</code>:</li></ul><p>Authentication method: URI, hostname with username/password, or certificate.</p><ul><li><code>Certificate</code>:</li></ul><p>Authentication method: URI, hostname with username/password, or certificate.</p><ul><li><code>CertificateWithCredentials</code>:</li></ul><p>Authentication method: URI, hostname with username/password, or certificate.</p><p><br>Default: <code>-</code><br>Example: <code>URI</code></p>                                                                                                                                                                                                             |
| 🗝Host : `String`                                     | <p>URI or hostname to connect to, depending on authentication method.</p><p><br>Default: <code>-</code><br>Example: <code>RabbitHost, amqp\://foo:bar\@localhost:1234</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Username : `String`                                   | <p>Username to use when authenticating to the server.</p><p><br>Default: <code>-</code><br>Example: <code>foo</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 🗝Password : `String`                                 | <p>Password to use when authenticating to the server.</p><p><br>Default: <code>-</code><br>Example: <code>bar</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Port : `Int32`                                        | <p>The port to connect on. Value 0 indicates that the default port for the protocol should be used.</p><p><br>Default: <code>-</code><br>Example: <code>0</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| SslProtocol : `SslProtocol`                           | <p>Specifies the SSL protocol used for the RabbitMQ connection. Use SslProtocol.None to allow the operating system to negotiate the most secure protocol available.</p><p>Possible values:</p><ul><li><code>None</code>:</li></ul><p>Specifies the SSL protocol used for the RabbitMQ connection. Use SslProtocol.None to allow the operating system to negotiate the most secure protocol available.</p><ul><li><code>Tls12</code>:</li></ul><p>Specifies the SSL protocol used for the RabbitMQ connection. Use SslProtocol.None to allow the operating system to negotiate the most secure protocol available.</p><ul><li><code>Tls13</code>:</li></ul><p>Specifies the SSL protocol used for the RabbitMQ connection. Use SslProtocol.None to allow the operating system to negotiate the most secure protocol available.</p><p><br>Default: <code>-</code><br>Example: <code>SslProtocol.None</code></p> |
| CertificateSource : `CertificateSource`               | <p>Specifies the source from which the client certificate should be loaded.</p><p>Possible values:</p><ul><li><code>File</code>:</li></ul><p>Specifies the source from which the client certificate should be loaded.</p><ul><li><code>Store</code>:</li></ul><p>Specifies the source from which the client certificate should be loaded.</p><ul><li><code>Base64</code>:</li></ul><p>Specifies the source from which the client certificate should be loaded.</p><ul><li><code>RawBytes</code>:</li></ul><p>Specifies the source from which the client certificate should be loaded.</p><p><br>Default: <code>-</code><br>Example: <code>CertificateSource.File</code></p>                                                                                                                                                                                                                                   |
| ClientCertificatePath : `String`                      | <p>Full file system path to a client certificate file (.pfx or .p12) used for TLS client‑certificate authentication.</p><p><br>Default: <code>-</code><br>Example: <code>C:\certs\client-auth.pfx</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| 🗝ClientCertificatePassword : `String`                | <p>Password required to decrypt the certificate file. Needed for password‑protected .pfx/.p12 certificates.</p><p><br>Default: <code>-</code><br>Example: <code>MyStrongPassword123!</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| 🗝CertificateBase64 : `String`                        | <p>Base64‑encoded representation of a client certificate (.pfx or .p12).</p><p><br>Default: <code>-</code><br>Example: <code>MIIF2wIBAzCCB...</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| 🗝CertificateBytes : `Byte[]`                         | <p>Raw byte array containing a client certificate (.pfx or .p12).</p><p><br>Default: <code>-</code><br>Example: <code>byte\[] { 1, 2, 3, 4, 5 }</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| StoreThumbprint : `String`                            | <p>Thumbprint of a certificate stored in the Windows certificate store.</p><p><br>Default: <code>-</code><br>Example: <code>ab12cd34ef56ab78cd90ef12ab34cd56ef7890ab</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| CertificateStoreLocation : `CertificateStoreLocation` | <p>Windows certificate store location to search when loading a certificate by thumbprint.</p><p>Possible values:</p><ul><li><code>LocalMachine</code>:</li></ul><p>Windows certificate store location to search when loading a certificate by thumbprint.</p><ul><li><code>CurrentUser</code>:</li></ul><p>Windows certificate store location to search when loading a certificate by thumbprint.</p><p><br>Default: <code>-</code><br>Example: <code>CertificateStoreLocation.CurrentUser</code></p>                                                                                                                                                                                                                                                                                                                                                                                                         |
| QueueName : `String`                                  | <p>The name of the queue. Leave empty to make the server generate a name.</p><p><br>Default: <code>-</code><br>Example: <code>SampleQueue</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ExchangeName : `String`                               | <p>Exchange's name.</p><p><br>Default: <code>-</code><br>Example: <code>SampleExchange</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| RoutingKey : `String`                                 | <p>Routing key's name.</p><p><br>Default: <code>-</code><br>Example: <code>route</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| VirtualHost : `String`                                | <p>RabbitMQ virtual host to connect to.</p><p><br>Default: <code>/</code><br>Example: <code>/</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Timeout : `Int32`                                     | <p>Timeout setting for connection attempts. Value 0 indicates that the default value for the attempts should be used. Set value in seconds.</p><p><br>Default: <code>-</code><br>Example: <code>60</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| {% endtab %}                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

{% tab title="Result: Result" %}

| Name                             | Description                                                                                              |
| -------------------------------- | -------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`              | Read status. There was no messages to read if MessageUTF8 and MessagesBase64 are empty but Success=true. |
| MessagesBase64 : `List<Message>` | <p>Message in Base64 format.<br>Example: <code>VGVzdCBtZXNzYWdl, {foo, bar}, 1, 1</code></p>             |
| MessageUTF8 : `List<Message>`    | <p>Message in UTF8 format.<br>Example: <code>Test message, {foo, bar}, 1, 1</code></p>                   |
| {% endtab %}                     |                                                                                                          |

{% tab title="Changelog" %}

## Changelog

### \[2.1.0] - 2026-03-17

#### Added

* Added CertificateWithCredentials authentication method that requires both a valid client certificate and username/password credentials to connect.
* Added Certificate authentication method for TLS client-certificate authentication with new enums (`CertificateSource`, `SslProtocol`, `CertificateStoreLocation`) and connection properties (`ClientCertificatePath`, `ClientCertificatePassword`, `CertificateBase64`, `CertificateBytes`, `StoreThumbprint`, `CertificateStoreLocation`, `SslProtocol`, `CertificateSource`).
* Added VirtualHost field to Connection parameters to allow specifying a RabbitMQ virtual host. Defaults to "/".

### \[2.0.0] - 2026-02-23

#### Changed

* Acknowledgement of messages logic was simplified.
* Types of acknowledge actions were clarified.
* **\[Breaking Change]** Rename ManualAck to NoAck as it's more descriptive (ack is not set with this option and can't be sent manually within this task)
* **\[Breaking Change]** Rename `Connection.AutoAck` property to `Connection.AckType`

### \[1.1.0] - 2025-02-14

#### Fixed

* Update RabbitMQ.Client from 6.4.0 to 7.1.2

### \[1.0.2] - 2023-03-14

#### Fixed

* Fixed issue with connections and channels were left open by implementing IDisposable class in ConnectionHelper class.

#### Added

* Added support for reading messages from quorum queues.

### \[1.0.1] - 2022-10-12

#### Added

* New property: Result.Success to indicate that the Read task was successfully completed.

### \[1.0.0] - 2022-08-22

#### Added

* Initial implementation
  {% endtab %}
  {% endtabs %}
