TransactedBatchingBehavior(Int32) Constructor
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.
Initializes a new instance of the TransactedBatchingBehavior class with the specified batch size.
public:
TransactedBatchingBehavior(int maxBatchSize);
public TransactedBatchingBehavior (int maxBatchSize);
new System.ServiceModel.Description.TransactedBatchingBehavior : int -> System.ServiceModel.Description.TransactedBatchingBehavior
Public Sub New (maxBatchSize As Integer)
Parameters
- maxBatchSize
- Int32
The maximum number of receive operations that can be batched together.
Exceptions
MaxBatchSize
is less than 0.
Examples
The following code shows how to create a new instance of TransactedBatchingBehavior specifying the maximum number of messages to be processed in a batch.
endpoint.Behaviors.Add(new TransactedBatchingBehavior(10));
Remarks
The maxBatchSize
value passed into the constructor 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.