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 » VB.NET API to Listen the Queue indefinitely

Post new topic  Reply to topic
 VB.NET API to Listen the Queue indefinitely « View previous topic :: View next topic » 
Author Message
Suresh2008
PostPosted: Tue Apr 08, 2008 12:59 am    Post subject: VB.NET API to Listen the Queue indefinitely Reply with quote

Newbie

Joined: 08 Apr 2008
Posts: 5

Dear Friends,
i am trying to listen(read) the Queue indefinitely.
below is the code snippet for this.


While True
Dim myque As IBM.WMQ.MQQueue = qManager.AccessQueue("SAMPLE", MQC.MQOO_INPUT_AS_Q_DEF Or MQC.MQOO_INQUIRE)
Dim msg As New IBM.WMQ.MQMessage()
Dim gmo As New IBM.WMQ.MQGetMessageOptions()
gmo.WaitInterval = MQC.MQWI_UNLIMITED
gmo.Options = MQC.MQGMO_WAIT
myque.Get(msg, gmo)
Debug.Print(msg.ReadString(msg.DataLength))
myque.Close()
End While

but after few mins. , The Thread is getting exists with is the following exceptions but my program is still running.
The thread 0xd60 has exited with code 0 (0x0).
The thread 0xafc has exited with code 0 (0x0).

please help me...
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Apr 08, 2008 1:04 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Apart from anything else, do NOT open & close the queue inside the loop!
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 08, 2008 1:06 am    Post subject: Re: VB.NET API to Listen the Queue indefinitely Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Suresh2008 wrote:
i am trying to listen(read) the Queue indefinitely.
below is the code snippet for this.


Not connected to your problem, but there's no facility in the code shown to terminate the wait. I do hope you have some means of exiting the code cleanly (i.e. not by just cancelling the thread) or do you dislike your MQ administrator?


Suresh2008 wrote:
but after few mins. , The Thread is getting exists with is the following exceptions but my program is still running.
The thread 0xd60 has exited with code 0 (0x0).
The thread 0xafc has exited with code 0 (0x0).


Where's the evidence this is a WMQ problem? Have you reviewed the threading information in the .NET manual? What kind of connection are you using to the queue manager? What version of .NET? What version of WMQ?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 08, 2008 1:08 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

zpat wrote:
Apart from anything else, do NOT open & close the queue inside the loop!




But performance problems can probably be filed until after the code is working!!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Suresh2008
PostPosted: Tue Apr 08, 2008 1:33 am    Post subject: Re: VB.NET API to Listen the Queue indefinitely Reply with quote

Newbie

Joined: 08 Apr 2008
Posts: 5

Suresh2008 wrote:
Dear Friends,
i am trying to listen(read) the Queue indefinitely.
below is the code snippet for this.


While True
Dim myque As IBM.WMQ.MQQueue = qManager.AccessQueue("SAMPLE", MQC.MQOO_INPUT_AS_Q_DEF Or MQC.MQOO_INQUIRE)
Dim msg As New IBM.WMQ.MQMessage()
Dim gmo As New IBM.WMQ.MQGetMessageOptions()
gmo.WaitInterval = MQC.MQWI_UNLIMITED
gmo.Options = MQC.MQGMO_WAIT
myque.Get(msg, gmo)
Debug.Print(msg.ReadString(msg.DataLength))
myque.Close()
End While

but after few mins. , The Thread is getting exists with is the following exceptions but my program is still running.
The thread 0xd60 has exited with code 0 (0x0).
The thread 0xafc has exited with code 0 (0x0).

please help me...
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 08, 2008 1:43 am    Post subject: Re: VB.NET API to Listen the Queue indefinitely Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Suresh2008 wrote:
Suresh2008 wrote:
Dear Friends,
i am trying to listen(read) the Queue indefinitely.
below is the code snippet for this.


While True
Dim myque As IBM.WMQ.MQQueue = qManager.AccessQueue("SAMPLE", MQC.MQOO_INPUT_AS_Q_DEF Or MQC.MQOO_INQUIRE)
Dim msg As New IBM.WMQ.MQMessage()
Dim gmo As New IBM.WMQ.MQGetMessageOptions()
gmo.WaitInterval = MQC.MQWI_UNLIMITED
gmo.Options = MQC.MQGMO_WAIT
myque.Get(msg, gmo)
Debug.Print(msg.ReadString(msg.DataLength))
myque.Close()
End While

but after few mins. , The Thread is getting exists with is the following exceptions but my program is still running.
The thread 0xd60 has exited with code 0 (0x0).
The thread 0xafc has exited with code 0 (0x0).

please help me...


Why does this look like you've just reposted your original post with the addition of an emoticon? What am I missing?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Apr 08, 2008 1:55 am    Post subject: Re: VB.NET API to Listen the Queue indefinitely Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Vitor wrote:
Suresh2008 wrote:
but after few mins. , The Thread is getting exists with is the following exceptions but my program is still running.
The thread 0xd60 has exited with code 0 (0x0).
The thread 0xafc has exited with code 0 (0x0).


Where's the evidence this is a WMQ problem? Have you reviewed the threading information in the .NET manual? What kind of connection are you using to the queue manager? What version of .NET? What version of WMQ?



_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Suresh2008
PostPosted: Tue Apr 08, 2008 2:05 am    Post subject: Reply with quote

Newbie

Joined: 08 Apr 2008
Posts: 5

Hi,

Sorry for repeating the posts. Below is my entire code, which is listening the Queue for a while and after a while the thread kills by itself . Whether this MQ Problem first?

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' TextBox1.Text = ""
'SendQueMessage()
'Dim myxmlArray As ArrayList()
' TextBox1.Text = ReadQueMessage()
' Dim myMsg As String = TextBox1.Text

MQEnvironment.Hostname = "localhost"
MQEnvironment.Channel = "SYSTEM.AUTO.SVRCONN"
MQEnvironment.Port = 1414
Dim qManager As IBM.WMQ.MQQueueManager = New IBM.WMQ.MQQueueManager()

qManager.Connect("QM1")
Dim myque As IBM.WMQ.MQQueue = qManager.AccessQueue("SAMPLE", MQC.MQOO_INPUT_AS_Q_DEF Or MQC.MQOO_INQUIRE)
'Dim myque As IBM.WMQ.MQQueue = qManager.AccessQueue("RHB.FEE.INQ.REQ.TOCHIP", MQC.MQOO_INPUT_AS_Q_DEF Or MQC.MQOO_OUTPUT)


'gmo.Options = MQC.MQGMO_WAIT Or MQC.MQWI_UNLIMITED
'While gmo.Options
'Dim i As Short = gmo.Options
While True

Dim msg As New IBM.WMQ.MQMessage()
Dim gmo As New IBM.WMQ.MQGetMessageOptions()
gmo.WaitInterval = MQC.MQWI_UNLIMITED
gmo.Options = MQC.MQGMO_WAIT
myque.Get(msg, gmo)
Debug.Print(msg.ReadString(msg.DataLength))

End While
myque.Close()

End Sub
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 08, 2008 2:45 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Suresh2008 wrote:
Whether this MQ Problem first?


Again I ask why you think this it is? Where's your evidence?

I also repeat my previous questions, which you seem to have ignored.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Suresh2008
PostPosted: Tue Apr 08, 2008 3:39 am    Post subject: Reply with quote

Newbie

Joined: 08 Apr 2008
Posts: 5

Dear Vitor,

i am using the C#.Net 2005 and MQ Series 5.3 versions.
please advice.
Back to top
View user's profile Send private message
Suresh2008
PostPosted: Tue Apr 08, 2008 3:44 am    Post subject: Reply with quote

Newbie

Joined: 08 Apr 2008
Posts: 5

Dear Vitor,
here i am trying with both VB.Net 2005 and C#.net 2005.
Now for VB.NET 2005 its working fine.
but in C#.net 2005 its not working, and the thread is slipping after 2 or 3 mins. but in Vb.net its ok now.

please advice.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Apr 08, 2008 4:00 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You are not tracking MQ Exceptions.

So you don't know if this is caused by MQ or something else.
_________________
I am *not* the model of the modern major general.
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 » VB.NET API to Listen the Queue indefinitely
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.