Sets the scheduled send interval for the secondary queue, if range intervals are enabled for the program. If not, an exception will be thrown. If the specified interval is outside the allowable range, an exception will be thrown.

Namespace:  Linxter.SDK
Assembly:  Linxter.SDK (in Linxter.SDK.dll) Version: 1.5.0.0 (1.5.0.0)

Syntax

C#
void SetSecondaryScheduledSendInterval(
	int interval
)
Visual Basic (Declaration)
Sub SetSecondaryScheduledSendInterval ( _
	interval As Integer _
)

Parameters

interval
Type: System..::.Int32
The secondary queue send interval in milliseconds.

Examples

CopyC#
ILinxterMessaging m_Msg;

public void SetIntervalsExample()
{
    // Set up Linxter
    m_Msg = new LinxterSDK();

    // Set send and receive intervals
    //  send interval = 10s
    //  secondary (out-of-band) send interval = 300s
    //  receive interval = 60s
    SetIntervals(10, 300, 60);

    // Hook PropertyChanged event so when a setting is changed, we log an event
    m_Msg.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnPropertyChanged);
}

public void SetIntervals(int sendInterval,
    int secondarySendInterval, int receiveInterval)
{
    string statusMessage = string.Empty;
    int sendMS = sendInterval * 1000;
    int secondaryMS = secondarySendInterval * 1000;
    int receiveMS = receiveInterval * 1000;

    // If the program configuration allows, set send, secondary send, and receive 
    // intervals to the specified values
    if (m_Msg.SendSettings.IsScheduledRangeEnabled)
    {
        if (m_Msg.SendSettings.ScheduledMinInterval < sendMS &&
            m_Msg.SendSettings.ScheduledMaxInterval > sendMS)
        {
            m_Msg.SetScheduledSendInterval(sendMS);
        }
        else
        {
            statusMessage = "Send interval out of range.\n";
        }
    }
    else
    {
        statusMessage = "Cannot set send interval.\n";
    }

    if (m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled)
    {
        if (m_Msg.SecondaryQueueSendSettings.ScheduledMinInterval < secondaryMS &&
            m_Msg.SecondaryQueueSendSettings.ScheduledMaxInterval > secondaryMS)
        {
            m_Msg.SetSecondaryScheduledSendInterval(secondaryMS);
        }
        else
        {
            statusMessage += "Secondary send interval out of range.\n";
        }
    }
    else
    {
        statusMessage += "Cannot set secondary send interval.\n";
    }

    if (m_Msg.ReceiveSettings.IsScheduledRangeEnabled)
    {
        if (m_Msg.ReceiveSettings.ScheduledMinInterval < receiveMS &&
            m_Msg.ReceiveSettings.ScheduledMaxInterval > receiveMS)
        {
            m_Msg.SetScheduledReceiveInterval(receiveMS);
        }
        else
        {
            statusMessage += "Receive interval out of range.\n";
        }
    }
    else
    {
        statusMessage += "Cannot set receive interval.\n";
    }

    if (string.IsNullOrEmpty(statusMessage))
    {
        MessageBox.Show("Linxter send/receive intervals set successfully!");
    }
    else
    {
        MessageBox.Show(string.Format("{0}\n\nPlease use Linxter Web Manager to adjust send/receive settings.", statusMessage));
    }
}

public void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
    // Create event log entries showing the current message settings
    using (System.Diagnostics.EventLog evt = new System.Diagnostics.EventLog("Application"))
    {
        evt.Source = "Set Intervals Example";
        string message = string.Format("Send settings:\n{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}",
            string.Format("Batch size: {0}\n", m_Msg.SendSettings.BatchSize),
            string.Format("Attachements are {0}\n"), (m_Msg.SendSettings.IsAttachmentEnabled == true ? "enabled" : "disabled"),
            string.Format("ISB Timeout: {0}\n", m_Msg.SendSettings.ISBTimeout),
            string.Format("Interval {0} be customized\n", (m_Msg.SendSettings.IsScheduledRangeEnabled ? "can" : "cannot")),
            string.Format("", (m_Msg.SendSettings.IsScheduledRangeEnabled == true ? string.Format("Max attachment size {0}\n", m_Msg.SendSettings.MaxAttachmentSize) : string.Empty)),
            string.Format("Max message size: {0}\n", m_Msg.SendSettings.MaxMessageSize),
            string.Format("Scheduled interval: {0}\n", m_Msg.SendSettings.ScheduledInterval),
            string.Format("Min interval: {0}\n", m_Msg.SendSettings.ScheduledMinInterval),
            string.Format("Max interval: {0}\n", m_Msg.SendSettings.ScheduledMaxInterval),
            string.Format("Selected interval: {0}", m_Msg.SendSettings.SelectedInterval));
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000);
        message = string.Format("Secondary Send settings:\n{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}",
            string.Format("Batch size: {0}\n", m_Msg.SecondaryQueueSendSettings.BatchSize),
            string.Format("Attachements are {0}\n"), (m_Msg.SecondaryQueueSendSettings.IsAttachmentEnabled == true ? "enabled" : "disabled"),
            string.Format("ISB Timeout: {0}\n", m_Msg.SecondaryQueueSendSettings.ISBTimeout),
            string.Format("Interval {0} be customized\n", (m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled ? "can" : "cannot")),
            string.Format("", (m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled == true ? string.Format("Max attachment size {0}\n", m_Msg.SecondaryQueueSendSettings.MaxAttachmentSize) : string.Empty)),
            string.Format("Max message size: {0}\n", m_Msg.SecondaryQueueSendSettings.MaxMessageSize),
            string.Format("Scheduled interval: {0}\n", m_Msg.SecondaryQueueSendSettings.ScheduledInterval),
            string.Format("Min interval: {0}\n", m_Msg.SecondaryQueueSendSettings.ScheduledMinInterval),
            string.Format("Max interval: {0}\n", m_Msg.SecondaryQueueSendSettings.ScheduledMaxInterval),
            string.Format("Selected interval: {0}", m_Msg.SecondaryQueueSendSettings.SelectedInterval));
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000);
        message = string.Format("Receive settings:\n{0}{1}{2}{3}{4}{5}{6}{7}",
            string.Format("Attachements are {0}\n"), (m_Msg.ReceiveSettings.IsAttachmentEnabled == true ? "enabled" : "disabled"),
            string.Format("Interval {0} be customized\n", (m_Msg.ReceiveSettings.IsScheduledRangeEnabled ? "can" : "cannot")),
            string.Format("", (m_Msg.ReceiveSettings.IsScheduledRangeEnabled == true ? string.Format("Max attachment size {0}\n", m_Msg.ReceiveSettings.MaxAttachmentSize) : string.Empty)),
            string.Format("Max message size: {0}\n", m_Msg.ReceiveSettings.MaxMessageSize),
            string.Format("Scheduled interval: {0}\n", m_Msg.ReceiveSettings.ScheduledInterval),
            string.Format("Min interval: {0}\n", m_Msg.ReceiveSettings.ScheduledMinInterval),
            string.Format("Max interval: {0}\n", m_Msg.ReceiveSettings.ScheduledMaxInterval),
            string.Format("Selected interval: {0}", m_Msg.ReceiveSettings.SelectedInterval));
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000);
    }
}
CopyVB.NET
Private m_Msg As ILinxterMessaging

Public Sub SetIntervalsExample()
    ' Set up Linxter
    m_Msg = New LinxterSDK()

    ' Set send and receive intervals
    '  send interval = 10s
    '  secondary (out-of-band) send interval = 300s
    '  receive interval = 60s
    SetIntervals(10, 300, 60)

    ' Hook PropertyChanged event so when a setting is changed, we log an event
    AddHandler m_Msg.PropertyChanged, AddressOf OnPropertyChanged
End Sub

Public Sub SetIntervals(ByVal sendInterval As Integer, ByVal secondarySendInterval As Integer, ByVal receiveInterval As Integer)
    Dim statusMessage As String = String.Empty
    Dim sendMS As Integer = sendInterval * 1000
    Dim secondaryMS As Integer = secondarySendInterval * 1000
    Dim receiveMS As Integer = receiveInterval * 1000

    ' If the program configuration allows, set send, secondary send, and receive 
    ' intervals to the specified values
    If m_Msg.SendSettings.IsScheduledRangeEnabled Then
        If m_Msg.SendSettings.ScheduledMinInterval < sendMS AndAlso m_Msg.SendSettings.ScheduledMaxInterval > sendMS Then
            m_Msg.SetScheduledSendInterval(sendMS)
        Else
            statusMessage = "Send interval out of range." & vbLf
        End If
    Else
        statusMessage = "Cannot set send interval." & vbLf
    End If

    If m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled Then
        If m_Msg.SecondaryQueueSendSettings.ScheduledMinInterval < secondaryMS AndAlso m_Msg.SecondaryQueueSendSettings.ScheduledMaxInterval > secondaryMS Then
            m_Msg.SetSecondaryScheduledSendInterval(secondaryMS)
        Else
            statusMessage &= "Secondary send interval out of range." & vbLf
        End If
    Else
        statusMessage &= "Cannot set secondary send interval." & vbLf
    End If

    If m_Msg.ReceiveSettings.IsScheduledRangeEnabled Then
        If m_Msg.ReceiveSettings.ScheduledMinInterval < receiveMS AndAlso m_Msg.ReceiveSettings.ScheduledMaxInterval > receiveMS Then
            m_Msg.SetScheduledReceiveInterval(receiveMS)
        Else
            statusMessage &= "Receive interval out of range." & vbLf
        End If
    Else
        statusMessage &= "Cannot set receive interval." & vbLf
    End If

    If String.IsNullOrEmpty(statusMessage) Then
        MessageBox.Show("Linxter send/receive intervals set successfully!")
    Else
        MessageBox.Show(String.Format("{0}" & vbLf & vbLf & "Please use Linxter Web Manager to adjust send/receive settings.", statusMessage))
    End If
End Sub

Public Sub OnPropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs)
    ' Create event log entries showing the current message settings
    Using evt As New System.Diagnostics.EventLog("Application")
        evt.Source = "Set Intervals Example"
        Dim message As String = String.Format("Send settings:" & vbLf & "{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}", String.Format("Batch size: {0}" & vbLf, m_Msg.SendSettings.BatchSize), String.Format("Attachements are {0}" & vbLf), (If(m_Msg.SendSettings.IsAttachmentEnabled = True, "enabled", "disabled")), String.Format("ISB Timeout: {0}" & vbLf, m_Msg.SendSettings.ISBTimeout), String.Format("Interval {0} be customized" & vbLf, (If(m_Msg.SendSettings.IsScheduledRangeEnabled, "can", "cannot"))), String.Format("", (If(m_Msg.SendSettings.IsScheduledRangeEnabled = True, String.Format("Max attachment size {0}" & vbLf, m_Msg.SendSettings.MaxAttachmentSize), String.Empty))), String.Format("Max message size: {0}" & vbLf, m_Msg.SendSettings.MaxMessageSize), String.Format("Scheduled interval: {0}" & vbLf, m_Msg.SendSettings.ScheduledInterval), String.Format("Min interval: {0}" & vbLf, m_Msg.SendSettings.ScheduledMinInterval), String.Format("Max interval: {0}" & vbLf, m_Msg.SendSettings.ScheduledMaxInterval), String.Format("Selected interval: {0}", m_Msg.SendSettings.SelectedInterval))
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000)
        message = String.Format("Secondary Send settings:" & vbLf & "{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}", String.Format("Batch size: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.BatchSize), String.Format("Attachements are {0}" & vbLf), (If(m_Msg.SecondaryQueueSendSettings.IsAttachmentEnabled = True, "enabled", "disabled")), String.Format("ISB Timeout: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.ISBTimeout), String.Format("Interval {0} be customized" & vbLf, (If(m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled, "can", "cannot"))), String.Format("", (If(m_Msg.SecondaryQueueSendSettings.IsScheduledRangeEnabled = True, String.Format("Max attachment size {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.MaxAttachmentSize), String.Empty))), String.Format("Max message size: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.MaxMessageSize), String.Format("Scheduled interval: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.ScheduledInterval), String.Format("Min interval: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.ScheduledMinInterval), String.Format("Max interval: {0}" & vbLf, m_Msg.SecondaryQueueSendSettings.ScheduledMaxInterval), String.Format("Selected interval: {0}", m_Msg.SecondaryQueueSendSettings.SelectedInterval))
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000)
        message = String.Format("Receive settings:" & vbLf & "{0}{1}{2}{3}{4}{5}{6}{7}", String.Format("Attachements are {0}" & vbLf), (If(m_Msg.ReceiveSettings.IsAttachmentEnabled = True, "enabled", "disabled")), String.Format("Interval {0} be customized" & vbLf, (If(m_Msg.ReceiveSettings.IsScheduledRangeEnabled, "can", "cannot"))), String.Format("", (If(m_Msg.ReceiveSettings.IsScheduledRangeEnabled = True, String.Format("Max attachment size {0}" & vbLf, m_Msg.ReceiveSettings.MaxAttachmentSize), String.Empty))), String.Format("Max message size: {0}" & vbLf, m_Msg.ReceiveSettings.MaxMessageSize), String.Format("Scheduled interval: {0}" & vbLf, m_Msg.ReceiveSettings.ScheduledInterval), String.Format("Min interval: {0}" & vbLf, m_Msg.ReceiveSettings.ScheduledMinInterval), String.Format("Max interval: {0}" & vbLf, m_Msg.ReceiveSettings.ScheduledMaxInterval), String.Format("Selected interval: {0}", m_Msg.ReceiveSettings.SelectedInterval))
        evt.WriteEntry(message, System.Diagnostics.EventLogEntryType.Information, 1000)
    End Using
End Sub

See Also