ServiceBusMessageBatch.TryAddMessage(ServiceBusMessage) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to add a message to the batch, ensuring that the size of the batch does not exceed its maximum.
public bool TryAddMessage (Azure.Messaging.ServiceBus.ServiceBusMessage message);
member this.TryAddMessage : Azure.Messaging.ServiceBus.ServiceBusMessage -> bool
Public Function TryAddMessage (message As ServiceBusMessage) As Boolean
Parameters
- message
- ServiceBusMessage
The message to attempt to add to the batch.
Returns
true
if the message was added; otherwise, false
.
Exceptions
When a batch is sent, it will be locked for the duration of that operation. During this time,
no messages may be added to the batch. Calling TryAdd
while the batch is being sent will
result in an InvalidOperationException until the send has completed.
Occurs when the message
has a member in its ApplicationProperties collection that is an
unsupported type for serialization. See the ApplicationProperties remarks for details.
Remarks
When a message is accepted into the batch, changes made to its properties will not be reflected in the batch nor will any state transitions be reflected to the original instance.
Note: Any ReadOnlyMemory<T>, byte array, or BinaryData instance associated with the event is referenced by the batch and must remain valid and unchanged until the batch is disposed.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應