Author |
Message
|
Suresh2008 |
Posted: Tue Apr 08, 2008 12:59 am Post subject: VB.NET API to Listen the Queue indefinitely |
|
|
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 |
|
 |
zpat |
Posted: Tue Apr 08, 2008 1:04 am Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Tue Apr 08, 2008 1:06 am Post subject: Re: VB.NET API to Listen the Queue indefinitely |
|
|
 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 |
|
 |
Vitor |
Posted: Tue Apr 08, 2008 1:08 am Post subject: |
|
|
 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 |
|
 |
Suresh2008 |
Posted: Tue Apr 08, 2008 1:33 am Post subject: Re: VB.NET API to Listen the Queue indefinitely |
|
|
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 |
|
 |
Vitor |
Posted: Tue Apr 08, 2008 1:43 am Post subject: Re: VB.NET API to Listen the Queue indefinitely |
|
|
 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 |
|
 |
jefflowrey |
Posted: Tue Apr 08, 2008 1:55 am Post subject: Re: VB.NET API to Listen the Queue indefinitely |
|
|
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 |
|
 |
Suresh2008 |
Posted: Tue Apr 08, 2008 2:05 am Post subject: |
|
|
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 |
|
 |
Vitor |
Posted: Tue Apr 08, 2008 2:45 am Post subject: |
|
|
 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 |
|
 |
Suresh2008 |
Posted: Tue Apr 08, 2008 3:39 am Post subject: |
|
|
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 |
|
 |
Suresh2008 |
Posted: Tue Apr 08, 2008 3:44 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Apr 08, 2008 4:00 am Post subject: |
|
|
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 |
|
 |
|