Jump to content

using DLQueue event-less interface


johnstahl

Recommended Posts

I am trying to develop a simple interface for DLQueue. I have been able to connect to the Queue, but I am not able to submit a job.

 

Does any one have an example of what the submit should look like. Even better an example of a working application. Any lanuage is acceptable.

 

The lack of examples in the doumentation can be very difficult.

 

Thank you

John

Link to comment
Share on other sites

  • 2 weeks later...

Below is a VB/VBScript example of a basic connection and job submission using the DL Queue Client API (DLQueueClient.ocx). It demonstrates how to poll and wait for a job to be completed.

 
Option Explicit
Function RunJob(CommandLine, SchedulerName, UserName, Password)
   Dim DLQClient1 As DLQueueClient
   Dim Status As DLQ_CONNECTION_STATUS
   Dim Job As DLQueueJob
   Dim Token As Long, MYERROR As Long

   RunJob = False

   Set DLQClient1 = CreateObject("DLQueueClient")
   Status = DLQClient1.ConnectRemote(SchedulerName, UserName, Password, 10)

   If Status <> DLQ_ConnStatus_Connected Then
       document.write _ DLQClient1.ConnStatusString(DLQClient1.ConnectionStatus), _
                   Title:="Connection failed"
       DLQClient1.Disconnect
       Set DLQClient1 = Nothing
       Exit Function
   End If

   document.write "Connected: ID=" & DLQClient1.Connection.ID & _
   '        ", LoginName=" & DLQClient1.Connection.LoginName & _
   '        ", MachineName=" & DLQClient1.Connection.MachineName
   Set Job = CreateObject("DLQueueJob")
   Job.CommandLine = CommandLine
   Job.Name = "Q1"

   MYERROR = DLQClient1.SubmitJob(Job, 10, False)
   Token = Job.Token

   Do
       Set Job = DLQClient1.GetJobByToken(Token)
       If Job Is Nothing Then Exit Do
       If DLQClient1.IsJobStatusFinal(Job.Status) Then Exit Do
       DLQClient1.Sleep 100
       'DoEvents
   Loop

   If Job Is Nothing Then
       Document.write "Job not found after submission!"
       Exit Function
   End If

   Document.write "Job completed with return code " & _
           Job.ReturnCode
   Set Job = Nothing
   DLQClient1.Disconnect
   Set DLQClient1 = Nothing

   RunJob = True
End Function

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...