本文整理汇总了VB.NET中System.Messaging.MessageQueue.DefaultPropertiesToSend属性的典型用法代码示例。如果您正苦于以下问题:VB.NET MessageQueue.DefaultPropertiesToSend属性的具体用法?VB.NET MessageQueue.DefaultPropertiesToSend怎么用?VB.NET MessageQueue.DefaultPropertiesToSend使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Messaging.MessageQueue
的用法示例。
在下文中一共展示了MessageQueue.DefaultPropertiesToSend属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyNewQueue
' 导入命名空间
Imports System.Messaging
Public Class MyNewQueue
' Provides an entry point into the application.
'
' This example specifies different types of default
' properties for messages.
Public Shared Sub Main()
' Create a new instance of the class.
Dim myNewQueue As New MyNewQueue()
' Send normal and high priority messages.
myNewQueue.SendNormalPriorityMessages()
myNewQueue.SendHighPriorityMessages()
Return
End Sub
' Associates selected message property values
' with high priority messages.
Public Sub SendHighPriorityMessages()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Associate selected default property values with high
' priority messages.
myQueue.DefaultPropertiesToSend.Priority = _
MessagePriority.High
myQueue.DefaultPropertiesToSend.Label = _
"High Priority Message"
myQueue.DefaultPropertiesToSend.Recoverable = True
myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
New TimeSpan(0, 0, 30)
' Send messages using these defaults.
myQueue.Send("High priority message data 1.")
myQueue.Send("High priority message data 2.")
myQueue.Send("High priority message data 3.")
Return
End Sub
' Associates selected message property values
' with normal priority messages.
Public Sub SendNormalPriorityMessages()
' Connect to a message queue.
Dim myQueue As New MessageQueue(".\myQueue")
' Associate selected default property values with normal
' priority messages.
myQueue.DefaultPropertiesToSend.Priority = _
MessagePriority.Normal
myQueue.DefaultPropertiesToSend.Label = _
"Normal Priority Message"
myQueue.DefaultPropertiesToSend.Recoverable = False
myQueue.DefaultPropertiesToSend.TimeToReachQueue = _
New TimeSpan(0, 2, 0)
' Send messages using these defaults.
myQueue.Send("Normal priority message data 1.")
myQueue.Send("Normal priority message data 2.")
myQueue.Send("Normal priority message data 3.")
Return
End Sub
End Class