MessageBufferPolicy Class
The policy to set on an Windows Azure Service Bus message buffer endpoint.
Inheritance Hierarchy
System. . :: . .Object
Microsoft.ServiceBus..::..MessageBufferPolicy
Namespace: Microsoft.ServiceBus
Assembly: Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
Syntax
'Declaration
<DataContractAttribute(Name := "MessageBufferPolicy", Namespace := "https://schemas.microsoft.com/netservices/2009/05/servicebus/connect")> _
Public Class MessageBufferPolicy _
Implements IExtensibleDataObject
'Usage
Dim instance As MessageBufferPolicy
[DataContractAttribute(Name = "MessageBufferPolicy", Namespace = "https://schemas.microsoft.com/netservices/2009/05/servicebus/connect")]
public class MessageBufferPolicy : IExtensibleDataObject
[DataContractAttribute(Name = L"MessageBufferPolicy", Namespace = L"https://schemas.microsoft.com/netservices/2009/05/servicebus/connect")]
public ref class MessageBufferPolicy : IExtensibleDataObject
[<DataContractAttribute(Name = "MessageBufferPolicy", Namespace = "https://schemas.microsoft.com/netservices/2009/05/servicebus/connect")>]
type MessageBufferPolicy =
class
interface IExtensibleDataObject
end
public class MessageBufferPolicy implements IExtensibleDataObject
The MessageBufferPolicy type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MessageBufferPolicy() () () () | Initializes a new instance of the MessageBufferPolicy class. | |
MessageBufferPolicy(MessageBufferPolicy) | Initializes a new instance of the MessageBufferPolicy class, using the specified message buffer as a copy. |
Top
Properties
Name | Description | |
---|---|---|
Authorization | Gets or sets the authorization policy for the message buffer. | |
Discoverability | Gets or sets the discoverability policy for the message buffer. | |
ExpiresAfter | Gets or sets the duration after which the message buffer expires. | |
MaxMessageCount | Gets or sets the maximum message count. | |
OverflowPolicy | Gets or sets the overflow policy. | |
TransportProtection | Gets or sets the transport protection policy. |
Top
Methods
Name | Description | |
---|---|---|
Equals | Returns a value that indicates whether the specified object has the same properties as this message buffer policy. (Overrides Object. . :: . .Equals(Object).) | |
Finalize | (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Overrides Object. . :: . .GetHashCode() () () ().) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
ToString | (Inherited from Object.) |
Top
Remarks
Important
The current Message Buffers feature, including their management protocol, will remain supported for backwards compatibility. However, the general recommendation is that you explicitly change client code to use the new Queue feature. For more information, see Service Bus Queues, Topics, and Subscriptions.
The message buffer policy controls the type of security used on the message buffer, as well as the lifespan of the message buffer, and what to do when the buffer fills up with messages. For more information on setting message buffer policy, see How to: Configure an AppFabric Service Bus Message Buffer.
Examples
The following code example describes how to create a message buffer policy and use it to instantiate a new message buffer.
string serviceNamespace = "myServiceNamespace";
MessageVersion messageVersion = MessageVersion.Soap12WSAddressing10;
string messageAction = "urn:Message";
// Configure credentials
TransportClientEndpointBehavior behavior = new TransportClientEndpointBehavior();
behavior.CredentialType = TransportClientCredentialType.SharedSecret;
behavior.Credentials.SharedSecret.IssuerName = "...";
behavior.Credentials.SharedSecret.IssuerSecret = "...";
// Configure buffer policy
MessageBufferPolicy policy = new MessageBufferPolicy
{
ExpiresAfter = TimeSpan.FromMinutes(2.0d),
MaxMessageCount = 100
};
// Create buffer
Uri bufferName = new Uri("https://" + serviceNamespace + ".servicebus.windows.net/services/MyBuffer");
MessageBufferClient client = MessageBufferClient.CreateMessageBuffer(behavior, bufferName, policy, messageVersion);
// Send some messages
for (int i = 0; i < 10; ++i)
{
client.Send(Message.CreateMessage(messageVersion, messageAction, "Message #" + i);
}
Message message;
string content;
// Retrieve a message (destructive read)
message = client.Retrieve();
content = message.GetBody<string>();
message.Close();
Console.WriteLine("Retrieve message content: {0}", content);
// Retrieve a message (peek/lock)
message = client.PeekLock();
content = message.GetBody<string>();
Console.WriteLine("PeekLock message content: {0}", content);
// Delete previously locked message
client.DeleteLockedMessage(message);
message.Close();
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.