BrokeredMessage BrokeredMessage Class

Represents the unit of communication between AppFabric ServiceBus clients.

Syntax

Declaration

public sealed class BrokeredMessage : IXmlSerializable, IDisposablePublic NotInheritable Class BrokeredMessage
    Implements IXmlSerializable, IDisposable

Inheritance Hierarchy

Constructors summary

Initializes a new instance of the BrokeredMessage class.

Initializes a new instance of the BrokeredMessage class.

Initializes a new instance of the BrokeredMessage class using the supplied stream as its body.

Initializes a new instance of the BrokeredMessage class from a given object by using DataContractSerializer with a binary XmlDictionaryWriter.

Constructor that creates a BrokeredMessage from a given object using the provided XmlObjectSerializer

Properties summary

Gets or sets the type of the content.

Gets or sets the identifier of the correlation.

Gets the number of deliveries.

Gets or sets the enqueued sequence number of the message.

Gets or sets the date and time of the sent time in UTC.

Gets the date and time in UTC at which the message is set to expire.

Gets or sets a value that indicates whether the message is to be persisted to the database immediately, instead of being held in memory for a short time. This property is ignored if the message is sent to a non-express queue or topic.

Specifies whether the message has been consumed.

Gets or sets the application specific label.

Gets the date and time in UTC until which the message will be locked in the queue/subscription.

Gets the lock token assigned by Service Bus to this message.

Gets or sets the identifier of the message. This is a user-defined value that Service Bus can use to identify duplicate messages, if enabled.

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

Gets the application specific message properties.

Gets or sets the address of the queue to reply to.

Gets or sets the session identifier to reply to.

Gets or sets the date and time in UTC at which the message will be enqueued. This property returns the time in UTC; when setting the property, the supplied DateTime value must also be in UTC.

Gets the unique number assigned to a message by the Service Bus.

Gets or sets the identifier of the session.

Gets the size of the message in bytes.

Gets or sets the state of the message.

Gets or sets the message’s time to live value. This is the duration after which the message expires, starting from when the message is sent to the Service Bus. Messages older than their TimeToLive value will expire and no longer be retained in the message store. Subscribers will be unable to receive expired messages.TimeToLive is the maximum lifetime that a message can receive, but its value cannot exceed the entity specified the DefaultMessageTimeToLive value on the destination queue or subscription. If a lower TimeToLive value is specified, it will be applied to the individual message. However, a larger value specified on the message will be overridden by the entity’s DefaultMessageTimeToLive value.

Gets or sets the send to address.

Gets or sets a partition key value when a transaction is to be used to send messages via a transfer queue.

Methods summary

Abandons the lock on a peek-locked message.

Abandons the lock on a peek-locked message.

Asynchronously abandons the lock on a peek-locked message.

Asynchronously abandons the lock on a peek-locked message.

Clones a message, so that it is possible to send a clone of a message as a new message.

Completes the receive operation of a message and indicates that the message should be marked as processed and deleted.

Asynchronously completes the receive operation of a message and indicates that the message should be marked as processed and deleted.

Moves the message to the dead letter queue.

Moves the message to the dead letter queue.

Moves the message to the dead letter queue.

Asynchronously moves the message to the dead letter queue.

Asynchronously moves the message to the dead letter queue.

Asynchronously moves the message to the dead letter queue.

Indicates that the receiver wants to defer the processing for this message.

Indicates that the receiver wants to defer the processing for this message.

Asynchronously indicates that the receiver wants to defer the processing for this message.

Asynchronously indicates that the receiver wants to defer the processing for this message.

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Deserializes the brokered message body into an object of the specified type by using the DataContractSerializer with a binary XmlDictionaryReader.

Deserializes the BrokeredMessage body into an object of the specified type using DataContractSerializer with a Binary XmlObjectSerializer.

Renews the lock on a message.

Asynchronously renews the lock on a message.

Returns a string that represents the current message.

Explicit Interface Implementations summary

This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the XmlSchemaProviderAttribute to the class.

Generates an object from its XML representation. This method is reserved for internal use and should not be used directly or indirectly (for example, using a serializer or a formatter).

Converts an object into its XML representation. This method is reserved for internal use and should not be used directly or indirectly (e.g. using a serializer or a formatter).

Constructors

  • BrokeredMessage()
    BrokeredMessage()

    Initializes a new instance of the BrokeredMessage class.

    public BrokeredMessage()Public Sub New
  • BrokeredMessage(Stream)
    BrokeredMessage(Stream)

    Initializes a new instance of the BrokeredMessage class.

    public BrokeredMessage(Stream messageBodyStream)Public Sub New(messageBodyStream As Stream)

    Parameters

  • BrokeredMessage(Stream, Boolean)
    BrokeredMessage(Stream, Boolean)

    Initializes a new instance of the BrokeredMessage class using the supplied stream as its body.

    public BrokeredMessage(Stream messageBodyStream, bool ownsStream)Public Sub New(messageBodyStream As Stream, ownsStream As Boolean)

    Parameters

    • messageBodyStream

      The message body stream.

    • ownsStream

      true to indicate that the stream will be closed when the message is closed; false to indicate that the stream will not be closed when the message is closed.

  • BrokeredMessage(Object)
    BrokeredMessage(Object)

    Initializes a new instance of the BrokeredMessage class from a given object by using DataContractSerializer with a binary XmlDictionaryWriter.

    public BrokeredMessage(object serializableObject)Public Sub New(serializableObject As Object)

    Parameters

  • BrokeredMessage(Object, XmlObjectSerializer)
    BrokeredMessage(Object, XmlObjectSerializer)

    Constructor that creates a BrokeredMessage from a given object using the provided XmlObjectSerializer

    public BrokeredMessage(object serializableObject, XmlObjectSerializer serializer)Public Sub New(serializableObject As Object, serializer As XmlObjectSerializer)

    Parameters

    Exceptions

    Remarks

    You should be aware of the exceptions that their provided Serializer can throw and take appropriate actions. Please refer to for a possible list of exceptions and their cause.

Properties

  • ContentType
    ContentType

    Gets or sets the type of the content.

    public string ContentType { get; set; }Public Property ContentType As String

    Property Value

    • The type of the content of the message body. This is a content type identifier utilized by the sender and receiver for application specific logic.

    Exceptions

  • CorrelationId
    CorrelationId

    Gets or sets the identifier of the correlation.

    public string CorrelationId { get; set; }Public Property CorrelationId As String

    Property Value

    Exceptions

  • DeadLetterSource
    DeadLetterSource
    public string DeadLetterSource { get; }Public ReadOnly Property DeadLetterSource As String

    Property Value

  • DeliveryCount
    DeliveryCount

    Gets the number of deliveries.

    public int DeliveryCount { get; }Public ReadOnly Property DeliveryCount As Integer

    Property Value

    Exceptions

  • EnqueuedSequenceNumber
    EnqueuedSequenceNumber

    Gets or sets the enqueued sequence number of the message.

    public long EnqueuedSequenceNumber { get; }Public ReadOnly Property EnqueuedSequenceNumber As Long

    Property Value

    • The enqueued sequence number of the message.

  • EnqueuedTimeUtc
    EnqueuedTimeUtc

    Gets or sets the date and time of the sent time in UTC.

    public DateTime EnqueuedTimeUtc { get; }Public ReadOnly Property EnqueuedTimeUtc As Date

    Property Value

    • The enqueue time in UTC. This value represents the actual time of enqueuing the message.

    Exceptions

  • ExpiresAtUtc
    ExpiresAtUtc

    Gets the date and time in UTC at which the message is set to expire.

    public DateTime ExpiresAtUtc { get; }Public ReadOnly Property ExpiresAtUtc As Date

    Property Value

    Exceptions

  • ForcePersistence
    ForcePersistence

    Gets or sets a value that indicates whether the message is to be persisted to the database immediately, instead of being held in memory for a short time. This property is ignored if the message is sent to a non-express queue or topic.

    public bool ForcePersistence { get; set; }Public Property ForcePersistence As Boolean

    Property Value

    • true if the message is to be persisted to the database immediately, instead of being held in memory for a short time; otherwise, false.

  • IsBodyConsumed
    IsBodyConsumed

    Specifies whether the message has been consumed.

    public bool IsBodyConsumed { get; }Public ReadOnly Property IsBodyConsumed As Boolean

    Property Value

    • true if the message has been consumed; otherwise, false.

  • Label
    Label

    Gets or sets the application specific label.

    public string Label { get; set; }Public Property Label As String

    Property Value

    Exceptions

  • LockedUntilUtc
    LockedUntilUtc

    Gets the date and time in UTC until which the message will be locked in the queue/subscription.

    public DateTime LockedUntilUtc { get; }Public ReadOnly Property LockedUntilUtc As Date

    Property Value

    • The date and time until which the message will be locked in the queue/subscription.

    Exceptions

  • LockToken
    LockToken

    Gets the lock token assigned by Service Bus to this message.

    public Guid LockToken { get; }Public ReadOnly Property LockToken As Guid

    Property Value

    • The lock token assigned by Service Bus to this message.

    Exceptions

  • MessageId
    MessageId

    Gets or sets the identifier of the message. This is a user-defined value that Service Bus can use to identify duplicate messages, if enabled.

    public string MessageId { get; set; }Public Property MessageId As String

    Property Value

    Exceptions

  • PartitionKey
    PartitionKey

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

    public string PartitionKey { get; set; }Public Property PartitionKey As String

    Property Value

    • The partition key for sending a transactional message.

  • Properties
    Properties

    Gets the application specific message properties.

    public IDictionary<string, object> Properties { get; }Public ReadOnly Property Properties As IDictionary(Of String, Object)

    Property Value

    Exceptions

  • ReplyTo
    ReplyTo

    Gets or sets the address of the queue to reply to.

    public string ReplyTo { get; set; }Public Property ReplyTo As String

    Property Value

    Exceptions

  • ReplyToSessionId
    ReplyToSessionId

    Gets or sets the session identifier to reply to.

    public string ReplyToSessionId { get; set; }Public Property ReplyToSessionId As String

    Property Value

    Exceptions

  • ScheduledEnqueueTimeUtc
    ScheduledEnqueueTimeUtc

    Gets or sets the date and time in UTC at which the message will be enqueued. This property returns the time in UTC; when setting the property, the supplied DateTime value must also be in UTC.

    public DateTime ScheduledEnqueueTimeUtc { get; set; }Public Property ScheduledEnqueueTimeUtc As Date

    Property Value

    • The scheduled enqueue time in UTC. This value is for delayed message sending. It is utilized to delay messages sending to a specific time in the future.

    Exceptions

  • SequenceNumber
    SequenceNumber

    Gets the unique number assigned to a message by the Service Bus.

    public long SequenceNumber { get; }Public ReadOnly Property SequenceNumber As Long

    Property Value

    • The unique number assigned to a message by the Service Bus.

    Exceptions

  • SessionId
    SessionId

    Gets or sets the identifier of the session.

    public string SessionId { get; set; }Public Property SessionId As String

    Property Value

    Exceptions

  • Size
    Size

    Gets the size of the message in bytes.

    public long Size { get; }Public ReadOnly Property Size As Long

    Property Value

    Exceptions

  • State
    State

    Gets or sets the state of the message.

    public MessageState State { get; }Public ReadOnly Property State As MessageState

    Property Value

  • TimeToLive
    TimeToLive

    Gets or sets the message’s time to live value. This is the duration after which the message expires, starting from when the message is sent to the Service Bus. Messages older than their TimeToLive value will expire and no longer be retained in the message store. Subscribers will be unable to receive expired messages.TimeToLive is the maximum lifetime that a message can receive, but its value cannot exceed the entity specified the DefaultMessageTimeToLive value on the destination queue or subscription. If a lower TimeToLive value is specified, it will be applied to the individual message. However, a larger value specified on the message will be overridden by the entity’s DefaultMessageTimeToLive value.

    public TimeSpan TimeToLive { get; set; }Public Property TimeToLive As TimeSpan

    Property Value

    Exceptions

  • To
    To

    Gets or sets the send to address.

    public string To { get; set; }Public Property To As String

    Property Value

    Exceptions

  • ViaPartitionKey
    ViaPartitionKey

    Gets or sets a partition key value when a transaction is to be used to send messages via a transfer queue.

    public string ViaPartitionKey { get; set; }Public Property ViaPartitionKey As String

    Property Value

    • The partition key value when a transaction is to be used to send messages via a transfer queue.

Methods

Explicit Interface Implementations

  • IXmlSerializable.GetSchema()
    System.Xml.Serialization.IXmlSerializable.GetSchema()

    This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the XmlSchemaProviderAttribute to the class.

    XmlSchema IXmlSerializable.GetSchema()Function System.Xml.Serialization.IXmlSerializable.GetSchema As XmlSchema Implements IXmlSerializable.GetSchema

    Returns

    • An XmlSchema that describes the XML representation of the object that is produced by the WriteXml method and consumed by the ReadXml method.

  • IXmlSerializable.ReadXml(XmlReader)
    System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader)

    Generates an object from its XML representation. This method is reserved for internal use and should not be used directly or indirectly (for example, using a serializer or a formatter).

    void IXmlSerializable.ReadXml(XmlReader reader)Sub System.Xml.Serialization.IXmlSerializable.ReadXml(reader As XmlReader) Implements IXmlSerializable.ReadXml

    Parameters

  • IXmlSerializable.WriteXml(XmlWriter)
    System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter)

    Converts an object into its XML representation. This method is reserved for internal use and should not be used directly or indirectly (e.g. using a serializer or a formatter).

    void IXmlSerializable.WriteXml(XmlWriter writer)Sub System.Xml.Serialization.IXmlSerializable.WriteXml(writer As XmlWriter) Implements IXmlSerializable.WriteXml

    Parameters

Details

Assembly

Microsoft.ServiceBus.dll