|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Q: Windows service and MQ QueryManger handle |
« View previous topic :: View next topic » |
Author |
Message
|
ZitherMQ |
Posted: Thu May 29, 2003 9:11 pm Post subject: Q: Windows service and MQ QueryManger handle |
|
|
Newbie
Joined: 29 May 2003 Posts: 1 Location: HK
|
Hi
I've been trying to create a windows service in vb.net using the MQ Client v5.2.1 and the mqseries.net package, but I think I'm running into a thread problem.
The code appears to work fine when run as a standard DLL and I can make a connection and disconnect to a Q without error. When I try to run the same code as a service, I can connect, but get a CompCode: 2, Reason: 2018 trying to Commit() or Disconnect(). I'm trying to persist the object reference to my MQQuery in the windows service class as our supplier insist we keep the Queue open and not keep opening/closing the QM.
Public Class MQQuery
Private pobjMQQM As MQ.MQQueueManager
...
Public Sub OpenConnection()
' initialise the MQSeries session and manager
Try
pobjMQQM = New MQ.MQQueueManager("")
LogMessage("OPENCONN_OK", "Opened Connection")
Catch ex As Exception
LogMessage("OPENCONN_FAIL", ex.Message)
End Try
End Sub
Public Sub CloseConnection()
If Not pobjMQQM Is Nothing Then
LogMessage("CLOSECONN", "Closing connection...")
Try
pobjMQQM.Commit()
Catch ex As Exception
LogMessage("ERROR", ex.Message)
End Try
LogMessage("CLOSECONN", "QM committed...")
Try
pobjMQQM.Disconnect()
Catch ex As Exception
LogMessage("ERROR", ex.Message)
End Try
LogMessage("CLOSECONN", "QM disconnected...")
End If
pobjMQQM = Nothing
End Sub
...
End Class
I'm new to vb.net, apologies if I'm missing something obvious.
Thanks in advance
Z |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|