ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Q: Windows service and MQ QueryManger handle

Post new topic  Reply to topic
 Q: Windows service and MQ QueryManger handle « View previous topic :: View next topic » 
Author Message
ZitherMQ
PostPosted: Thu May 29, 2003 9:11 pm    Post subject: Q: Windows service and MQ QueryManger handle Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Q: Windows service and MQ QueryManger handle
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.