다음을 통해 공유


NotificationClassProtocol Class

Represents a delivery protocol for a notification class.

네임스페이스: Microsoft.SqlServer.Management.Nmo
어셈블리: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

구문

‘선언
Public NotInheritable Class NotificationClassProtocol
    Inherits NamedSmoObject
public sealed class NotificationClassProtocol : NamedSmoObject
public ref class NotificationClassProtocol sealed : public NamedSmoObject
public final class NotificationClassProtocol extends NamedSmoObject
public final class NotificationClassProtocol extends NamedSmoObject

주의

Each notification class must define at least one delivery protocol to deliver notifications.

The delivery protocol must be associated with at least one InstanceDeliveryChannel.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.Management.Smo.SmoObjectBase
     Microsoft.SqlServer.Management.Smo.SqlSmoObject
       Microsoft.SqlServer.Management.Smo.NamedSmoObject
        Microsoft.SqlServer.Management.Nmo.NotificationClassProtocol

The following examples show how to define an SMTP delivery protocol and then add it to a notification class:

// Define an SMTP protocol for notification delivery
NotificationClassProtocol smtpProtocol = 
    new NotificationClassProtocol(flightNotifications, "SMTP");

// Define fields for the SMTP notifications
ProtocolField smtpProtocolField1 = 
    new ProtocolField(smtpProtocol, "Subject");
smtpProtocolField1.SqlExpression = 
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())";
smtpProtocol.ProtocolFields.Add(smtpProtocolField1);

ProtocolField smtpBodyField = 
    new ProtocolField(smtpProtocol, "BodyFormat");
smtpBodyField.SqlExpression = "'html'";
smtpProtocol.ProtocolFields.Add(smtpBodyField);

ProtocolField smtpFromField = 
    new ProtocolField(smtpProtocol, "From");
smtpFromField.SqlExpression = @"'sender@adventure-works.com'";
smtpProtocol.ProtocolFields.Add(smtpFromField);

ProtocolField smtpPriorityField = 
    new ProtocolField(smtpProtocol, "Priority");
smtpPriorityField.SqlExpression = "'Normal'";
smtpProtocol.ProtocolFields.Add(smtpPriorityField);

ProtocolField smtpToField = 
    new ProtocolField(smtpProtocol, "To");
smtpToField.SqlExpression = "DeviceAddress";
smtpProtocol.ProtocolFields.Add(smtpToField);

// Define protocol execution settings
smtpProtocol.FailuresBeforeEventLog = 2;
smtpProtocol.FailureEventLogInterval = new TimeSpan(0, 10, 0);
smtpProtocol.FailuresBeforeAbort = 10;
smtpProtocol.MulticastRecipientLimit = 50;
smtpProtocol.WorkItemTimeout = new TimeSpan(0, 20, 0);

// Add the SMTP protocol to the notification class
flightNotifications.NotificationClassProtocols.Add(smtpProtocol);
' Define an SMTP protocol for notification delivery
Dim smtpProtocol As NotificationClassProtocol = _
    New NotificationClassProtocol(flightNotifications, "SMTP")

' Define fields for the SMTP notifications
Dim smtpProtocolField1 As ProtocolField = _
    New ProtocolField(smtpProtocol, "Subject")
smtpProtocolField1.SqlExpression = _
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())"
smtpProtocol.ProtocolFields.Add(smtpProtocolField1)

Dim smtpBodyField As ProtocolField = _
    New ProtocolField(smtpProtocol, "BodyFormat")
smtpBodyField.SqlExpression = "'html'"
smtpProtocol.ProtocolFields.Add(smtpBodyField)

Dim smtpFromField As ProtocolField = _
    New ProtocolField(smtpProtocol, "From")
smtpFromField.SqlExpression = "'sender@adventure-works.com'"
smtpProtocol.ProtocolFields.Add(smtpFromField)

Dim smtpPriorityField As ProtocolField = _
    New ProtocolField(smtpProtocol, "Priority")
smtpPriorityField.SqlExpression = "'Normal'"
smtpProtocol.ProtocolFields.Add(smtpPriorityField)

Dim smtpToField As ProtocolField = _
    New ProtocolField(smtpProtocol, "To")
smtpToField.SqlExpression = "DeviceAddress"
smtpProtocol.ProtocolFields.Add(smtpToField)

' Define protocol execution settings
smtpProtocol.FailuresBeforeEventLog = 2
smtpProtocol.FailureEventLogInterval = New TimeSpan(0, 10, 0)
smtpProtocol.FailuresBeforeAbort = 10
smtpProtocol.MulticastRecipientLimit = 50
smtpProtocol.WorkItemTimeout = New TimeSpan(0, 20, 0)

' Add the SMTP protocol to the notification class
flightNotifications.NotificationClassProtocols.Add(smtpProtocol)

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

NotificationClassProtocol Members
Microsoft.SqlServer.Management.Nmo Namespace

관련 자료

배달 프로토콜 구성
Protocol Element (ADF)