# mulesoft Azure Event Hubs Connector - Full Documentation --- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Azure Event Hubs Connector 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Support Category: [Select](https://www.salesforce.com/en-us/wp-content/uploads/sites/4/documents/legal/Agreements/versioning-back-support-policy.pdf) Anypoint Connector for Azure Event Hubs (Azure Event Hubs Connector) enables support for event producing and consuming. Azure Event Hubs is a big data streaming platform and event ingestion service. It can receive and process millions of events per second. Data sent to an event hub can be transformed and stored by using any real-time analytics provider or batching/storage adapters. For information about compatibility and fixed issues, refer to the Azure Event Hubs Connector Release Notes. ## Before You Begin To use this connector, you must be familiar with: - Azure Event Hubs - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - How to create a Mule app using Anypoint Studio Before creating an app, you must have: - Credentials to access the Azure Event Hubs target resource - Anypoint Platform - Anypoint Studio or Anypoint Code Builder ## Common Use Cases for the Connector Some common use cases for Azure Event Hubs Connector include: - Sending an event - Sending an event to a specific partition - Sending a batch of events - Listening to events on Event Hubs - Listening to events on a specific partition ## Connection Types Azure Event Hubs Connector uses the SAS authentication and Active Directory authentication type. ## Security To get secured authentication to Azure Event Hubs, review the following recommendations: - [Use Java to send events to or receive events from Azure Event Hubs](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send?tabs=passwordless%2Croles-azure-portal) - [Authorizing access to Event Hubs resources using Shared Access Signatures](https://learn.microsoft.com/en-us/azure/event-hubs/authorize-access-shared-access-signature) - [Passwordless connections for Azure services](https://learn.microsoft.com/en-us/azure/developer/intro/passwordless-overview) ## Next Step After you complete the prerequisites, you are ready to create an app and configure the connector using Anypoint Studio. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Azure Event Hubs Messaging Connector Reference](https://docs.mulesoft.com/azure-event-hubs-connector/latest/azure-event-hubs-connector-reference) - [Salesforce Help](https://help.salesforce.com) --- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Azure Event Hubs Connector 1.2 Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following examples show several Mule flows for Azure Event Hubs Connector: - [Send a Single Event and Listen with EventHub Listener](#publish-single-event) This Mule flow sends a single event to an Event Hub. - [Publish a Batch of Events and Listen with Partition Listener](#publish-bulk-event) This Mule flow sends multiple events simultaneously to an Event Hub. - [Send Single Event with Content Type](#configure-json) This Mule flow sends a single event to an Event Hub with content type as JSON. ## Create a Configuration File for a Connection Create a configuration file that includes properties for a connection: 1. Create a file named `mule-app.properties` in the `/src/main/resources/` folder. 2. In the `mule-app.properties` file, create a set of properties for the connection, similar to the ones that follow, replacing the bracketed text (including the brackets) with the correct values for your configuration: config.namespace = config.eventHuName = ad-config.tenantId = ad-config.clientId = ad-config.ClientSecret = sas-config.sharedAccessKeyName = sas-config.sharedAccessKey = bs-config.containerName = bs-config.accountName = bs-config.accountKey = For more information about creating a properties file, refer to [Configuring Property Placeholders](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure). ## Send a Single Event and Listen with EventHub Listener This Mule flow sends a single event to an Event Hub. The result is displayed on the console. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Send a single event** Sends a single event - **Logger** Shows that the event was published - **Eventhub listener** Reads events from an event hub in a namespace. - **Logger** Logs that the event was listened. ![Studio flow for the Send a Single Event flow](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-example-1.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/events](http://localhost:8081/events)`. ## Publish a Batch of Events and Listen with Partition Listener This Mule flow sends multiple events simultaneously to an Event Hub. The result is displayed on the console. This example uses the following operations: - **HTTP Listener** Accepts data from HTTP requests - **Publish in bulk** Sends a batch of events - **Logger** Shows that the events were published - **Partition listener** Reads events from a specific event hub partition in a namespace - **Logger** Logs twice the events listened. ![Studio flow for the Publish a batch of Events flow](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-example-2.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ### Steps for Running This Example 1. Verify that your connector is configured. 2. Save the project. 3. From a web browser, test the application by entering `[http://localhost:8081/bulk](http://localhost:8081/bulk)`. ## Send Single Event with Content Type This Mule flow sends a single event to an Event Hub with content type as JSON. ![Send Single Event with Content Type configuration in Studio](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-example-3.png) ### XML for This Example Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Azure Event Hubs Connector 1.2 XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio: - If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can access the connector from your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. - If you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location and it also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/azure-event-hubs http://www.mulesoft.org/schema/mule/azure-event-hubs/current/mule-azure-event-hubs.xsd ``` This example shows how the namespace statements are placed in the XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. When you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml com.mulesoft.connectors mule4-azure-event-hubs-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `azure event hubs`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Azure Event Hubs Connector Reference 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for Azure Event Hubs (Azure Event Hubs Connector) enables support for event producing and consuming. ## Configurations --- ### Azure Event Hubs This class represents an extension configuration, values set in this class are commonly used across multiple operations since they represent something core from the extension. #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

Name for this configuration. Connectors reference the configuration with this name.

x

Connection

Connection types for this configuration.

x

Name

String

ID used to reference this configuration.

x

Expiration Policy

Configures an expiration policy for the configuration.

#### Connection Types ##### Active Directory Authentication Azure Event Hubs Connector offers two mechanisms to connect to Azure Event Hubs using Active Directory: - Connect with Token Credentials Properties (TenantId, ClientId, and ClientSecret) via service principal authentication. - Connect using DefaultAzureCredential that belong to Azure.Identity library. ###### Parameters
NameTypeDescriptionDefault ValueRequired

Token Credential Properties

Acquires a token via service principal authentication.

Use Azure Default Credential

Boolean

Use DefaultAzureCredentials mechanism.

false

Namespace

String

Event Hubs namespace name.

x

Azure Endpoint

String

Fully qualified domain name of the Event Hubs namespace.

servicebus.windows.net

Authority Host

String

Specifies the Azure active directory host.

https://login.microsoftonline.com/

Event Hub Name

String

Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Select the checkpointing connection provider.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

##### SAS Authentication A shared access signature (SAS) enables you to grant limited access to resources in your event hubs namespace. SAS guards access to Event Hubs resources based on authorization rules. Configure these rules either on a namespace or an event hub. ###### Parameters
NameTypeDescriptionDefault ValueRequired

Namespace

String

Event Hubs namespace name.

x

Shared Access Key Name

String

Shared access key name given by Azure.

x

Shared Access Key

String

Shared access key value given by Azure.

x

Event Hub Name

String

Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Select Azure blob storage connection provider.

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

## Supported Operations - [Publish in bulk](#BulkPublish) - [Send a single event](#Publish) ## Associated Sources - [Partition Listener](#PartitionListener) - [Eventhub Listener](#EventhubListener) ## Operations ## Publish in bulk `` Sends an event in bulk to a specified event hub. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

ID used to reference this configuration.

x

Events

Array of Event

The event’s content.

#[payload]

Correlation Id

String

Correlation ID.

Content Type

String

A MIME type describing the data contained in the EventBody, intended to allow consumers to make informed decisions for inspecting and processing the event.

Max Batch Size In Bytes

Number

Allow numbers greater than 24. If not configured, takes the default value configured in the Azure account.

0

Config Ref

ConfigurationProvider

Name of the configuration to use to execute this component.

x

Partition Id

String

Partition ID.

Partition Key

String

Partition key.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Azure Event Hubs](#AzureEventhubs) ### Throws - AZURE-EVENTHUBS:AEH\_ERROR - AZURE-EVENTHUBS:AUTHENTICATION - AZURE-EVENTHUBS:CONNECTIVITY - AZURE-EVENTHUBS:INVALID\_INPUT - AZURE-EVENTHUBS:RETRY\_EXHAUSTED ## Send a single event `` Sends an event to a specified event hub. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

Name of the configuration to use.

x

Event

The event’s content

#[payload]

Correlation Id

String

Correlation ID.

Content Type

String

A MIME type describing the data contained in the EventBody, intended to allow consumers to make informed decisions for inspecting and processing the event.

Config Ref

ConfigurationProvider

Name of the configuration to use to execute this component.

x

Partition Id

String

Partition ID.

Partition Key

String

Partition key.

Reconnection Strategy

Retry strategy in case of connectivity errors.

### For Configurations - [Azure Event Hubs](#AzureEventhubs) ### Throws - AZURE-EVENTHUBS:AEH\_ERROR - AZURE-EVENTHUBS:AUTHENTICATION - AZURE-EVENTHUBS:CONNECTIVITY - AZURE-EVENTHUBS:INVALID\_INPUT - AZURE-EVENTHUBS:RETRY\_EXHAUSTED ## Sources ## Partition Listener `` Reads events from a specific event hub partition in a namespace. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

ID used to reference this configuration.

x

Partition Id

String

Partition ID of the event hub.

x

Consumer Group

String

The consumer group to belong to.

Event Position Type

One of:

Defines the position of an event in an Event Hub partition. The position can be an enqueued time, offset, sequence number, the start of the stream, or the end of the stream.

Output Mime Type

String

The mime type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Config Ref

ConfigurationProvider

Name of the configuration to use to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

true

On Capacity Overload

Enumeration, one of:

  • DROP

  • WAIT

Strategy that Mule applies when the flow receives more messages than it has the capacity to manage.

DROP

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Reconnection strategy to use.

### Output

Type

Any

Attributes Type

### For Configurations - [Azure Event Hubs](#AzureEventhubs) ## Eventhub Listener `` Reads events from an event hub in a namespace. ### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

ID used to reference this configuration.

x

Consumer Group

String

The consumer group to belong to.

Event Position Type

One of:

Defines the position of an event in an Event Hub partition. The position can be an enqueued time, the start of the stream, or the end of the stream.

Checkpoint Frequency

Number

Frequency of updating the checkpoint. For instance, every 1000 events received.

Output Mime Type

String

Mime type of the payload that this operation outputs.

Output Encoding

String

Encoding of the payload that this operation outputs.

Config Ref

ConfigurationProvider

Name of the configuration to use to execute this component.

x

Primary Node Only

Boolean

Determines whether to execute this source on only the primary node when running Mule instances in a cluster.

On Capacity Overload

Enumeration, one of:

  • DROP

  • WAIT

Strategy that Mule applies when the flow receives more messages than it has the capacity to manage.

DROP

Streaming Strategy

Configures how Mule processes streams. Repeatable streams are the default behavior.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

Reconnection strategy to use.

### Output

Type

Any

Attributes Type

### For Configurations - [Azure Event Hubs](#AzureEventhubs) ## Types ### Token Credential Properties
FieldTypeDescriptionDefault ValueRequired

Tenant Id

String

Tenant ID.

Client Id

String

Client ID.

Client Secret

String

Client secret.

### Reconnection Configures a reconnection strategy for an operation.
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Reconnection Strategy

Reconnection strategy to use.

### Reconnect Configures a standard reconnection strategy, which specifies how often to reconnect and how many reconnection attempts the connector source or operation can make.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

Count

Number

How many reconnection attempts the Mule app can make.

### Reconnect Forever Configures a forever reconnection strategy by which the connector source or operation attempts to reconnect at a specified frequency for as long as the Mule app runs.
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often to attempt to reconnect, in milliseconds.

Blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

### Expiration Policy Configures an expiration policy strategy.
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

Configures the maximum amount of time that a dynamic configuration instance can remain idle before Mule considers it eligible for expiration.

Time Unit

Enumeration, one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit for the Max Idle Time field.

### Event Attributes
FieldTypeDescriptionDefault ValueRequired

Content Type

String

A MIME type describing the data contained in the EventBody, intended to allow consumers to make informed decisions for inspecting and processing the event.

Correlation Id

String

Correlation ID.

Enqueued Time

DateTime

The date and time, in UTC, of when the event was enqueued in the Event Hub partition.

Message Id

String

An application-defined value that uniquely identifies the event. The identifier is a free-form value and can reflect a GUID or an identifier derived from the application context.

Metadata

Object

Custom data added to the Event, it exists only for coordination between event publishers and consumers.

Offset

Number

An offset is the position of an event within a partition.

Sequence Number

Number

The sequence number assigned to the event when it was enqueued in the associated Event Hub partition.

### Repeatable In Memory Stream Configures the in-memory streaming strategy by which the request fails if the data exceeds the MAX buffer size. Always run performance tests to find the optimal buffer size for your specific use case.
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

Initial amount of memory to allocate to the data stream. If the streamed data exceeds this value, the buffer expands by Buffer Size Increment, with an upper limit of Max In Memory Size value.

Buffer Size Increment

Number

This is by how much the buffer size expands if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, meaning that a STREAM_MAXIMUM_SIZE_EXCEEDED error is raised when the buffer gets full.

Max Buffer Size

Number

Maximum size of the buffer. If the buffer size exceeds this value, Mule raises a STREAM_MAXIMUM_SIZE_EXCEEDED error. A value of less than or equal to 0 means no limit.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the Initial Buffer Size, Buffer Size Increment, and Buffer Unit fields.

### Repeatable File Store Stream Configures the repeatable file-store streaming strategy by which Mule keeps a portion of the stream content in memory. If the stream content is larger than the configured buffer size, Mule backs up the buffer’s content to disk and then clears the memory.
FieldTypeDescriptionDefault ValueRequired

In Memory Size

Number

Maximum amount of memory that the stream can use for data. If the amount of memory exceeds this value, Mule buffers the content to disk. To optimize performance:

  • Configure a larger buffer size to avoid the number of times Mule needs to write the buffer on disk. This increases performance, but it also limits the number of concurrent requests your application can process, because it requires additional memory.

  • Configure a smaller buffer size to decrease memory load at the expense of response time.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

Unit for the In Memory Size field.

### Redelivery Policy Configures the redelivery policy for executing requests that generate errors. You can add a redelivery policy to any source in a flow.
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

Maximum number of times that a redelivered request can be processed unsuccessfully before returning a REDELIVERY_EXHAUSTED error.

Message Digest Algorithm

String

Secure hashing algorithm to use if the Use Secure Hash field is true. If the payload of the message is a Java object, Mule ignores this value and returns the value that the payload’s hashCode() returned.

Message Identifier

One or more expressions that determine if a message was redelivered. This property can be set only if the Use Secure Hash field is false.

Object Store

ObjectStore

Configures the object store that stores the redelivery counter for each message.

### Redelivery Policy Message Identifier Configures how to identify a redelivered message and how to find out when the message was redelivered.
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

If true, Mule uses a secure hash algorithm to identify a redelivered message.

Id Expression

String

One or more expressions that determine when a message was redelivered. You can set this property only if the Use Secure Hash field is false.

### Event
FieldTypeDescriptionDefault ValueRequired

Body

String

Body of the event.

Metadata

Object

Metadata of the event.

### Off Set
FieldTypeDescriptionDefault ValueRequired

Offset

Number

An offset is the position of an event within a partition.

x

### Sequence
FieldTypeDescriptionDefault ValueRequired

Sequence

Number

The sequence number assigned to the event when it was enqueued in the associated Event Hub partition.

x

### Enqueued Time
FieldTypeDescriptionDefault ValueRequired

Instant

String

Selects the enqueue time to start looking for an event.

x

### Azure Blob Storage SAS Authentication
FieldTypeDescriptionDefault ValueRequired

Container Name

String

Container name.

x

Account Name

String

Account name of the Azure account.

x

Account Key

String

Account key of the Azure account.

x

### Azure Blob Storage Active Directory Authentication
FieldTypeDescriptionDefault ValueRequired

Token Credential Properties

Acquires a token via service principal authentication.

Use Azure Default Credential

Boolean

Setting this flag to true, DefaultAzureCredential Class(Azure.Identity) is created to get a token to authenticate.

false

Container Name

String

Container name.

x

Account Name

String

Account name of the Azure account.

x

Authority Host

String

Specifies the Azure active directory host.

https://login.microsoftonline.com/

### SAS Authentication
FieldTypeDescriptionDefault ValueRequired

Namespace

String

Event Hubs namespace name.

x

Shared Access Key Name

String

Shared access key name given by Azure

x

Shared Access Key

String

Shared access key value given by Azure.

x

Event Hub Name

String

Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Select the checkpointing connection provider.

### Active Directory Authentication
FieldTypeDescriptionDefault ValueRequired

Token Credential Properties

Acquires a token via service principal authentication.

Use Azure Default Credential

Boolean

Setting this flag to true, DefaultAzureCredential Class(Azure.Identity) is created to get a token to authenticate.

false

Namespace

String

Event Hubs namespace name.

x

Authority Host

String

Specifies the Azure active directory host.

https://login.microsoftonline.com/

Event Hub Name

String

Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Select the checkpointing connection provider.

--- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Troubleshooting Azure Event Hubs Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Azure Event Hubs Connector, become familiar with the information about enabling verbose logging and interpreting commonly thrown messages. ## Enable Verbose Logging To get a better understanding of why an application is failing, temporarily enable verbose logging for Azure Event Hubs Connector. Remember to always disable the enhanced verbosity after troubleshooting because it affects your Mule application performance. To enable verbose logging in the configuration file: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add an `` tag inside the `` tag: ```xml ... ... ``` 6. Save your application changes. 7. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. ## Understand Common Throws Here is a list of common throws messages and how to interpret them. - AZURE-EVENTHUBS:AEH\_ERROR An error occurs in Azure Event Hubs. - AZURE-EVENTHUBS:AUTHENTICATION Unable to authenticate to the Azure Event Hubs server. - AZURE-EVENTHUBS:CONNECTIVITY The client became disconnected from the event hub while attempting to publish an event. - AZURE-EVENTHUBS:INVALID\_INPUT The user sent an invalid input. - AZURE-EVENTHUBS:RETRY\_EXHAUSTED The maximum number of retries for the operation is reached. ## See Also - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: Azure Event Hubs Connector version: 1.2 is-latest-version: true --- # Using Anypoint Studio to Configure Azure Event Hubs Connector 1.2 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). 6. [Configure the other connector fields](#configure-other-fields). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Use Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, refer to the [Azure Event Hub Connector Reference](https://docs.mulesoft.com/azure-event-hubs-connector/latest/azure-event-hubs-connector-reference). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add Anypoint Connector for Azure Event Hubs Messaging (Azure Event Hubs Messaging Connector) to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `azure event hubs messaging` in the search field. 3. Click **Azure Event Hubs Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with Azure Event Hubs Connector: - HTTP Listener Initiates a flow each time it receives a request on the configured host and port - Scheduler Initiates a flow when a time-based condition is met For example, to configure an HTTP Listener source, follow these steps: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **Listener** to the Studio canvas. 3. On the **Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of the HTTP Listener source in the app. 6. On the **General** tab, specify the connection information for the connector. 7. On the **TLS** tab, optionally specify the TLS information for the connector. 8. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you are specifying an action for that connector to perform. To add an operation for Azure Event Hubs Messaging Connector, follow these steps: 1. In the **Mule Palette** view, select **Azure Event Hubs** and then select the desired operation. 2. Drag the operation onto the Studio canvas to the right of the source. ## Configure a Global Element for the Connector When you configure a connector, configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication that the connector requires to access the target Azure Event Hubs system. Azure Event Hubs Connector supports SAS authentication and Active Directory authentication. To configure the global element for Azure Event Hubs Connector, follow these steps: 1. Select the operation in the Studio canvas. 2. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 3. On the **General** tab, in **Connection**, select the authentication method to configure: - [SAS authentication](#config-sas) - [Active Directory authentication](#config-active) 4. On the **Advanced** tab, optionally specify reconnection information, including a reconnection strategy. 5. Click **Test Connection** to confirm that Mul runtime can connect with the specified server. 6. Click **OK**. ### Configure SAS Authentication Enter the following information on the **General** tab of the **Global Element Properties** screen to configure SAS authentication:
NameTypeDescriptionDefault ValueRequired

Namespace

String

Azure Event Hubs namespace name.

x

Shared Access Key Name

String

Shared access key provided by Azure.

x

Shared Access Key

String

Shared access key value provided by Azure.

x

Event Hub Name

String

Azure Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Selects the Azure Blob Storage connection.

Reconnection

Reconnection

Configures a reconnection strategy to use when the connector operation fails to connect to an external server.

### Configure Active Directory Authentication Enter the following information on the **General** tab of the **Global Element Properties** screen to configure Active Directory authentication. Using this authentication type enables you to configure **Token Credential Properties** or **Use default credentials**.
NameTypeDescriptionDefault ValueRequired

Token Credential Properties

Acquires a token via service principal authentication.

Use Azure Default Credential

Boolean

Use the DefaultAzureCredentials mechanism.

false

Namespace

String

Azure Event Hubs namespace name.

x

Authority Host

String

Specifies the Azure Active Directory host. Defaults to https://login.microsoftonline.com/

Event Hub Name

String

Event Hub name.

x

Share Connection

Boolean

Toggles the builder to use the same connection for producers or consumers.

false

Checkpoint Store Type

Select the checkpointing connection provider.

Reconnection

Reconnection

Configures a reconnection strategy to use when a connector operation fails to connect to an external server.

### Configure Azure Blob Storage SAS Authentication The following table shows the fields for configuring **Azure blob storage sas authentication**.
FieldTypeDescriptionDefault ValueRequired

Container Name

String

Container name.

x

Account Name

String

Account name of the Azure account.

x

Account Key

String

Account key of the Azure account.

x

### Configure Azure Blob Storage Active Directory Authentication The following table shows the fields to configure **Azure blob storage active directory authentication**.
FieldTypeDescriptionDefault ValueRequired

Token Credential Properties

Acquires a token via service principal authentication.

Use Azure Default Credential

Boolean

If you set this flag to true, DefaultAzureCredential Class(Azure.Identity) is created to get a token to authenticate.

false

Container Name

String

Container name.

x

Account Name

String

Account name of the Azure account.

x

Authority Host

String

Specifies the Azure active directory host. Defaults to https://login.microsoftonline.com/

### Configure Token Credential Properties The following table shows the fields for configuring **Token credentials properties**.
FieldTypeDescriptionDefault ValueRequired

Tenant Id

String

Tenant ID.

Client Id

String

Client ID.

Client Secret

String

Client secret.

### Configuration Examples The following example shows the configuration for **Sas Authentication** with **Azure blob storage sas authentication** in Studio: ![Configuration of azure blob storage SAS authentication](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-sas.png) In the **Configuration XML** editor, the `azure-eventhubs:sas-authentication-connection` and `azure-eventhubs:azure-blob-storage-sas-authentication` configurations look like this: ```xml ``` The following example shows the configuration for **Active directory authentication** with **Azure blob storage sas authentication** and **Token credentials properties** in Studio: ![Configuration of active directory authentication with client credentials](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-active-directory-client.png) In the **Configuration XML** editor, the `azure-eventhubs:active-directory-authentication-connection`, `azure-eventhubs:azure-blob-storage-sas-authentication`, and `azure-eventhubs:token-credential-properties` configurations look like this: ```xml ``` The following example shows the configuration for **Active directory authentication** with **Azure blob storage active directory authentication** and **Use azure default credentials** in Studio: ![Configuration of active directory authentication with default client credentials](/mulesoft/current/en-us/azure-event-hubs-connector/latest/_images/aeh-active-directory-default-client.png) In the **Configuration XML** editor, the `azure-eventhubs:active-directory-authentication-connection`, `azure-eventhubs:azure-blob-storage-sas-authentication` , and `useAzureDefaultCredential` configurations look like this: ```xml ``` ## Configure Additional Connector Fields After you configure a global element for Azure Event Hubs Connector, configure the other required fields for the connector. The required fields vary depending on which connector operation you use. ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the app log output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log output is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [Azure Event Hubs Messaging Reference](https://docs.mulesoft.com/azure-event-hubs-connector/latest/azure-event-hubs-connector-reference) - [Salesforce Help](https://help.salesforce.com)