Edit

Share via


Quickstart: Send and receive large messages with Azure Event Hubs

In this quickstart, you learn how to send and receive large messages (up to 20 MB) by using Azure Event Hubs. If you're new to Event Hubs, see Event Hubs overview before you begin.

Prerequisites

Configure an Event Hubs dedicated cluster

To stream large messages, you must configure your self-serve scalable dedicated cluster.

In the Azure portal, go to the Settings section for the dedicated cluster. Under Settings, select the Quota tab.

Screenshot that shows the Quota pane for a dedicated cluster.

  • Validate that the value for the read-only key supportslargemessages is set to True.
  • You can update the key eventhubmaxmessagesizeinbytes to a suitable value in bytes. An acceptable range for this value is between 1,048,576 and 20,971,520 bytes.

After you save the configuration, you're ready to stream large messages with Event Hubs.

Important

Large message streaming is only supported with self-serve scalable dedicated clusters built out of the latest infrastructure. The Supportslargemessages key reflects this capability.

If a cluster value is false, it doesn't support streaming large messages. To enable this feature, you must re-create the cluster. Streaming large messages doesn't incur any extra charges.

Stream large messages with Event Hubs

Eligible self serve Event hubs dedicated clusters allow streaming of large messages up to 20 MB, both in batches and as individual publications. You can use any existing Event Hubs SDK or Kafka API to stream large messages to Event Hubs. For existing connections, restart clients or re-establish connection to stream large messages.

For more information, see Send events to and receive events from Event Hubs by using .NET.

Tip

Make sure to review any Event Hubs Advanced Message Queuing Protocol (AMQP) client or Kafka client configuration that might limit the maximum message size that you stream into Event Hubs. You must update client timeout to a higher value (> 60s) to stream large message , and refine it based on your testing results to meet your workload needs.

By default, the AMQP client prefetch count is 300. Lower this value to avoid client-side memory issues when you deal with large messages.

For the complete SDK reference, see Azure Event Hubs libraries for .NET.