-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Enabling 20MB message for python sdk clients for Eventhubs #43232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
88f1597
25acdff
1ec44ab
59928f4
84f7e8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -359,6 +359,8 @@ def _get_max_message_size(self) -> None: | |||||||||
) | ||||||||||
or self._amqp_transport.MAX_MESSAGE_LENGTH_BYTES | ||||||||||
) | ||||||||||
print(f">>> _get_max_message_size: _max_message_size_on_link = {self._max_message_size_on_link}") | ||||||||||
print(f">>> _get_max_message_size: MAX_MESSAGE_LENGTH_BYTES = {self._amqp_transport.MAX_MESSAGE_LENGTH_BYTES}") | ||||||||||
|
||||||||||
def _start_producer(self, partition_id: str, send_timeout: Optional[float] = None) -> None: | ||||||||||
with self._lock: | ||||||||||
|
@@ -797,6 +799,9 @@ def create_batch( # pylint: disable=unused-argument | |||||||||
""" | ||||||||||
if not self._max_message_size_on_link: | ||||||||||
self._get_max_message_size() | ||||||||||
|
||||||||||
print(f">>> create_batch: max_size_in_bytes parameter = {max_size_in_bytes}") | ||||||||||
print(f">>> create_batch: _max_message_size_on_link = {self._max_message_size_on_link}") | ||||||||||
|
print(f">>> create_batch: max_size_in_bytes parameter = {max_size_in_bytes}") | |
print(f">>> create_batch: _max_message_size_on_link = {self._max_message_size_on_link}") | |
logger.debug(f">>> create_batch: max_size_in_bytes parameter = {max_size_in_bytes}") | |
logger.debug(f">>> create_batch: _max_message_size_on_link = {self._max_message_size_on_link}") |
Copilot uses AI. Check for mistakes.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -7,7 +7,7 @@ | |||
from typing import Any, Optional, TYPE_CHECKING | ||||
import uuid | ||||
import logging | ||||
|
||||
logging.basicConfig(level=logging.INFO) | ||||
|
logging.basicConfig(level=logging.INFO) |
Copilot uses AI. Check for mistakes.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -94,6 +94,22 @@ def send_event_data_list(producer): | |||||
except EventHubError as eh_err: | ||||||
print("Sending error: ", eh_err) | ||||||
|
||||||
def send_single_large_message(producer, size_mb=17): | ||||||
""" | ||||||
Try to send one single oversized message to Event Hub. | ||||||
Now with explicit large max_size_in_bytes to allow 20MB messages. | ||||||
""" | ||||||
payload = "X" * (size_mb * 1024 * 1024) # 20 MB string | ||||||
|
payload = "X" * (size_mb * 1024 * 1024) # 20 MB string | |
payload = "X" * (size_mb * 1024 * 1024) # Create a string of size_mb megabytes |
Copilot uses AI. Check for mistakes.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says '20MB limit' but the calculation is 19 * 1024 * 1024 which equals 19MB, not 20MB. The comment should accurately reflect the actual limit being set.
batch = producer.create_batch(max_size_in_bytes=19 * 1024 * 1024) # 20MB limit | |
batch = producer.create_batch(max_size_in_bytes=19 * 1024 * 1024) # 19MB limit (1MB below 20MB service max for safety) |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements should be removed from production code. Consider using proper logging with appropriate log levels instead of print statements.
Copilot uses AI. Check for mistakes.