SATıŞ: 1-800-867-1389
EN
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

BrokeredMessage.PartitionKey Property

Gets or sets a partition key for sending a transactional message to a queue or topic that is not session-aware.

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)

public string PartitionKey { get; set; }

Property Value

Type: System.String
The partition key for sending a transactional message.

Messages that are sent as part of a transaction must specify a partition key. This can be a SessionId, PartitionKey, or MessageId if the RequiresDuplicateDetection property is set to true. All messages that are sent as part of the same transaction must specify the same partition key.

Set the PartitionKey property if you want to send a transactional message to a queue or topic that is not session-aware. If you want to send a transactional message to a session-aware topic or queue, the message must have the SessionId property set. In this case, the PartitionKey property is optional. If you set the PartitionKey property, it must be identical to the SessionId property. If they differ, Service Bus returns an InvalidOperationException exception.

If you use a transaction to send a message without a partition key or multiple messages with different partition keys, Service Bus returns an InvalidOperationException exception.

CommittableTransaction committableTransaction = new CommittableTransaction();
using (TransactionScope ts = new TransactionScope(committableTransaction))
{
    BrokeredMessage msg = new BrokeredMessage("This is a message");
    msg.PartitionKey = "myPartitionKey";
    messageSender.Send(msg); 
    ts.Complete();
}
committableTransaction.Commit();
Bunu faydalı buldunuz mu?
(1500 karakter kaldı)
Geri bildiriminiz için teşekkür ederiz

Topluluk İçeriği

Ekle
Show:
© 2015 Microsoft