Share via


CreateMessageBuffer Method (TransportClientEndpointBehavior, Uri, MessageBufferPolicy, MessageVersion)

Creates a new message buffer on the Windows Azure Service Bus, using the specified credentials, URI, policy, and message version.

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

Syntax

'Declaration
Public Shared Function CreateMessageBuffer ( _
    credential As TransportClientEndpointBehavior, _
    messageBufferUri As Uri, _
    messageBufferPolicy As MessageBufferPolicy, _
    messageVersion As MessageVersion _
) As MessageBufferClient
'Usage
Dim credential As TransportClientEndpointBehavior
Dim messageBufferUri As Uri
Dim messageBufferPolicy As MessageBufferPolicy
Dim messageVersion As MessageVersion
Dim returnValue As MessageBufferClient

returnValue = MessageBufferClient.CreateMessageBuffer(credential, _
    messageBufferUri, messageBufferPolicy, _
    messageVersion)
public static MessageBufferClient CreateMessageBuffer(
    TransportClientEndpointBehavior credential,
    Uri messageBufferUri,
    MessageBufferPolicy messageBufferPolicy,
    MessageVersion messageVersion
)
public:
static MessageBufferClient^ CreateMessageBuffer(
    TransportClientEndpointBehavior^ credential, 
    Uri^ messageBufferUri, 
    MessageBufferPolicy^ messageBufferPolicy, 
    MessageVersion^ messageVersion
)
static member CreateMessageBuffer : 
        credential:TransportClientEndpointBehavior * 
        messageBufferUri:Uri * 
        messageBufferPolicy:MessageBufferPolicy * 
        messageVersion:MessageVersion -> MessageBufferClient 
public static function CreateMessageBuffer(
    credential : TransportClientEndpointBehavior, 
    messageBufferUri : Uri, 
    messageBufferPolicy : MessageBufferPolicy, 
    messageVersion : MessageVersion
) : MessageBufferClient

Parameters

Return Value

Type: Microsoft.ServiceBus. . :: . .MessageBufferClient
Returns a MessageBufferClient that contains the message buffer client that will interact with the message buffer.

Remarks

Use this constructor if you want to specify the type of message your message buffer will retrieve. By default, a message buffer will take any type of valid message sent to it, and will not filter. Therefore, you can use this constructor to restrict other clients from sending any type of message but the one you specify.

Note

Creating a message buffer with a name that already exists does not throw an error.

The message buffer URI should be in the following format:

https://{serviceNamespace}.servicebus.windows.net/{path}/{buffername}

For more information in creating a message buffer, see How to: Create an AppFabric Service Bus Message Buffer and the Message Buffer Overview.

Examples

The following code example shows how to instantiate a message buffer using this constructor.

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 = "REPLACE WITH ISSUER NAME";
behavior.Credentials.SharedSecret.IssuerSecret = "REPLACE WITH ISSUER SECRET";

// 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);

See Also

Reference

MessageBufferClient Class

CreateMessageBuffer Overload

Microsoft.ServiceBus Namespace