Muokkaa

Jaa


TransactedBatchingBehavior.MaxBatchSize Property

Definition

Gets or sets the maximum number of receive operations that can be batched together in one transaction.

public:
 property int MaxBatchSize { int get(); void set(int value); };
public int MaxBatchSize { get; set; }
member this.MaxBatchSize : int with get, set
Public Property MaxBatchSize As Integer

Property Value

The maximum number of receive operations that can be batched together in one transaction.

Exceptions

MaxBatchSize is less than 0.

Examples

The following code shows how to set the MaxBatchSize property.

ServiceEndpoint endpoint;
endpoint = serviceHost.AddServiceEndpoint(typeof(IQueueCalculator), new NetMsmqBinding(),"net.msmq://localhost/private/ServiceModelSamples");
TransactedBatchingBehavior batchBehavior = new TransactedBatchingBehavior(10);
batchBehavior.MaxBatchSize = 100;
endpoint.Behaviors.Add(new TransactedBatchingBehavior(10));

Remarks

The maxBatchSize value is only a hint. It is possible that all messages are received before reaching the maxBatchSize. When that occurs, it is unnecessary to wait indefinitely for another message to be received. To prevent this from happening, WCF commits the batch early and open a new batch to receive additional messages. The batch is committed if there are no messages to be received and 20 percent of the transaction time-out value has elapsed.

Applies to