|
|
|
|
@ -184,14 +184,14 @@ Public Class EDKB04OP
|
|
|
|
|
#Region "Timer"
|
|
|
|
|
Public Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs) Handles tmrQueuePolling.Elapsed
|
|
|
|
|
Try
|
|
|
|
|
m_log.log("EDKB04: OnTimedEvent called", Common.Common.JournalEntryType.Information)
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Start")
|
|
|
|
|
'm_log.log("EDKB04: OnTimedEvent called", Common.Common.JournalEntryType.Information)
|
|
|
|
|
|
|
|
|
|
ReadfromMQ()
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Error: " + ex.Message)
|
|
|
|
|
|
|
|
|
|
m_log.log("EDKB04: Exception catched in OnTimedEvent()")
|
|
|
|
|
Finally
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Finally")
|
|
|
|
|
|
|
|
|
|
tmrQueuePolling.Start()
|
|
|
|
|
m_log.log("EDKB04: tmrQueuePolling.Started")
|
|
|
|
|
End Try
|
|
|
|
|
@ -382,9 +382,7 @@ Public Class EDKB04OP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Function ReadfromMQ() As Boolean
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Globals")
|
|
|
|
|
Globals.archiveFilename = ""
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Dim")
|
|
|
|
|
Dim mqQMgr As MQQueueManager '* MQQueueManager instance
|
|
|
|
|
Dim mqQueue As MQQueue = Nothing '* MQQueue instance
|
|
|
|
|
Dim queueName As String '* Name of queue to use
|
|
|
|
|
@ -393,34 +391,25 @@ Public Class EDKB04OP
|
|
|
|
|
|
|
|
|
|
'tmrQueuePolling.Stop()
|
|
|
|
|
'm_log.Log("EDKB04: Start MQ Verbindungsaufbau", Common.Common.JournalEntryType.Information)
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: QueueName:" + Params.MQQueueName)
|
|
|
|
|
queueName = Params.MQQueueName
|
|
|
|
|
Try
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: MQEnv: Hostname" + Params.MQHostname)
|
|
|
|
|
MQEnvironment.Hostname = Params.MQHostname 'Bsp: "vb0049d"
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: MQEnv: Port" + Params.MQPort)
|
|
|
|
|
MQEnvironment.Port = Params.MQPort 'Bsp: 1416
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: MQEnv: Channel" + Params.MQChannel)
|
|
|
|
|
MQEnvironment.Channel = Params.MQChannel 'Bsp: "TGKB.D16.EDOKA.CL"
|
|
|
|
|
Try
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: New MQQueueManager")
|
|
|
|
|
mqQMgr = New MQQueueManager()
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: AccessQueue")
|
|
|
|
|
mqQueue = mqQMgr.AccessQueue(queueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING) '* open queue for input but not if MQM stopping
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Error: " + ex.Message)
|
|
|
|
|
m_log.log("EDKB04: MQ Error: " & ex.Message, Common.Common.JournalEntryType.Error)
|
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
Catch mqe As IBM.WMQ.MQException
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: MQExeption: " + mqe.Message)
|
|
|
|
|
m_log.log("EDKB04: Error: " & mqe.Message, Common.Common.JournalEntryType.Error)
|
|
|
|
|
m_log.log("EDKB04: Errorcode: " & mqe.CompletionCode, Common.Common.JournalEntryType.Error)
|
|
|
|
|
m_log.Log("EDKB04: Reasoncode: " & mqe.ReasonCode, Common.Common.JournalEntryType.Error)
|
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
Try
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Verarbeitung")
|
|
|
|
|
Dim isContinue As Boolean = True
|
|
|
|
|
Dim strXMLContent As String
|
|
|
|
|
Do While (isContinue = True)
|
|
|
|
|
@ -442,7 +431,6 @@ Public Class EDKB04OP
|
|
|
|
|
mqGetMsgOpts.Options = MQC.MQGMO_WAIT
|
|
|
|
|
|
|
|
|
|
Try
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: GetQueue:")
|
|
|
|
|
mqQueue.Get(mqMsg, mqGetMsgOpts)
|
|
|
|
|
'mqQueue.
|
|
|
|
|
If (mqMsg.Format.CompareTo(MQC.MQFMT_STRING) = 0) Then
|
|
|
|
|
@ -456,7 +444,6 @@ Public Class EDKB04OP
|
|
|
|
|
result = False
|
|
|
|
|
End If
|
|
|
|
|
Catch mqe As IBM.WMQ.MQException
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Error GetQueue: " + mqe.Message)
|
|
|
|
|
'* report reason, if any
|
|
|
|
|
|
|
|
|
|
If (mqe.Reason = MQC.MQRC_NO_MSG_AVAILABLE) Then
|
|
|
|
|
@ -464,7 +451,6 @@ Public Class EDKB04OP
|
|
|
|
|
m_log.log("EDKB04: no more messages", Common.Common.JournalEntryType.Information)
|
|
|
|
|
isContinue = False
|
|
|
|
|
Else
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Error: myStopper")
|
|
|
|
|
|
|
|
|
|
'* general report for other reasons
|
|
|
|
|
If Me.myStopper.insert Then m_log.log("EDKB04: MQQueue::Get ended with {0}: " & mqe.Message, Common.Common.JournalEntryType.Error)
|
|
|
|
|
@ -472,6 +458,7 @@ Public Class EDKB04OP
|
|
|
|
|
'* treat truncated message as a failure for this sample
|
|
|
|
|
'If (mqe.Reason = MQC.MQRC_TRUNCATED_MSG_FAILED) Then
|
|
|
|
|
isContinue = False
|
|
|
|
|
|
|
|
|
|
'End If
|
|
|
|
|
End If
|
|
|
|
|
result = False
|
|
|
|
|
@ -481,7 +468,6 @@ Public Class EDKB04OP
|
|
|
|
|
End If
|
|
|
|
|
Loop
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
File.AppendAllText(appPath + "\debug.log", Environment.NewLine + "ReadFromMQ: Error bei GET: " + ex.Message)
|
|
|
|
|
If Me.myStopper.insert Then m_log.log("EDKB04: Error bei GET: " & ex.Message, Common.Common.JournalEntryType.Error)
|
|
|
|
|
result = False
|
|
|
|
|
Finally
|
|
|
|
|
|