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 » catching an exception i don't want to catch

Post new topic  Reply to topic
 catching an exception i don't want to catch « View previous topic :: View next topic » 
Author Message
mtaylor314
PostPosted: Fri Sep 29, 2006 12:01 pm    Post subject: catching an exception i don't want to catch Reply with quote

Newbie

Joined: 19 Sep 2006
Posts: 9

Can anybody figure out why I am getting an exception here
I am using vb.net 2005 and MQ v5.3

Code:
Imports System
Imports System.IO
Imports IBM.WMQ

Module Module1

    Private Function GetLine() As String
        Dim strmRdr As StreamReader
        strmRdr = New StreamReader("FileName.txt")
        Dim line As String = strmRdr.ReadLine()
        Return line
    End Function
    Sub Main(ByVal CmdArgs() As String)
        Dim mqQMgr As MQQueueManager                'MQQueueManager instance
        Dim mqQueue As MQQueue                      'MQQueue instance
        Dim mqMsg As MQMessage                      'MQMessage instance
        Dim queueName As String                     'Name of the Queue to use
        Dim mqPutMsgOpts As MQPutMessageOptions     'MQPutMessageOptions instance
        'Dim msgLen As Integer                       'Length of Message
        'Dim message As String                       'Message "buffer"

        'Testing for the QueueName
        If (CmdArgs.Length = 0) Then
            System.Console.WriteLine("Queue Name required, please enter Queue Name")
            End
        Else
            queueName = CmdArgs.GetValue(0)
        End If

        '"Try"ing to Create a MQQueueManager instance
        Try
            If (CmdArgs.Length > 2) Then
                'have queueName, queue manager name, and channel definition
                Dim channelDefinition As String = CmdArgs.GetValue(2)
                Dim channelName As String
                Dim transportType As String
                Dim connectionName As String
                Dim seperator As Char() = "/"
                Dim parts As String() = channelDefinition.Split(seperator)

                If (parts.Length > 0) Then
                    channelName = parts(0)
                End If
                If (parts.Length > 1) Then
                    transportType = parts(1)
                End If
                If (parts.Length > 2) Then
                    connectionName = parts(2)
                End If
                mqQMgr = New MQQueueManager(CmdArgs.GetValue(1), channelName, connectionName)
            Else
                If (CmdArgs.Length = 2) Then
                    'only queue name and queue manager name provided
                    mqQMgr = New MQQueueManager(CmdArgs.GetValue(1))
                Else
                    'queue name provide, use default queue manager name
                    mqQMgr = New MQQueueManager
                End If
            End If
        Catch mqe As IBM.WMQ.MQException
            'stop if failed
            System.Console.WriteLine("The creation of MQQueueManager ended", mqe.Message)
            End
        End Try

        'Try to open the queue
        Try
            mqQueue = mqQMgr.AccessQueue(queueName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)
        Catch mqe As IBM.WMQ.MQException
            'stop if failed
            System.Console.WriteLine("MQQueueManager::AccessQueue ended with {0}", mqe.Message)
            End
        End Try

        'Read line from the data file and PUT them to the message queue
        Dim isContinue As Boolean = True
        Do While (isContinue = True)
            Try
                Dim line As String = GetLine()
                Dim lineLength = line.Length
                Do
                    If (lineLength > 0) Then
                        'Put the line to the queue
                        mqMsg = New MQMessage
                        mqMsg.WriteString(line)
                        mqMsg.Format = MQC.MQFMT_STRING
                        mqPutMsgOpts = New MQPutMessageOptions
                        Try             **********here's where I am catching exception**********************
                            mqQueue.Put(mqMsg, mqPutMsgOpts)
                        Catch mqe As IBM.WMQ.MQException
                            'Report the error
                            System.Console.WriteLine("MQQueue::Put ended with {0}", mqe.Message)
                        End Try
                    Else
                        'Quit loop if no more lines
                        isContinue = False
                    End If
                Loop
            Catch ex As Exception
                'The file wasn't read
                System.Console.WriteLine("File not read", ex.Message)
            End Try
        Loop
    End Sub

End Module


A lot of that code is copied from examples by IBM, I have a local queue named QUEUE1 and I have queue.manager.1 up and running. If you need any more info, please let me know. Thank you
Back to top
View user's profile Send private message AIM Address
mvic
PostPosted: Fri Sep 29, 2006 3:35 pm    Post subject: Re: catching an exception i don't want to catch Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

What is the exception? You should dump as much information from it as possible: it should wrap an MQ reason code (generally a 4-figure decimal number in the range 2000-3000) and completion code (for failure generally 2, sometimes 1).
Back to top
View user's profile Send private message
mtaylor314
PostPosted: Mon Oct 02, 2006 5:13 am    Post subject: Reply with quote

Newbie

Joined: 19 Sep 2006
Posts: 9

The reason code is 2053 with the completion code of 2
Code:
{"Error in the application."}
    CompCode: 2
    CompletionCode: 2
    Data: {System.Collections.ListDictionaryInternal}
    HelpLink: Nothing
    InnerException: Nothing
    Message: "Error in the application."
    Reason: 2053
    ReasonCode: 2053
    Source: "amqmdnet"
    StackTrace: "   at IBM.WMQ.MQQueue.Put(MQMessage message, MQPutMessageOptions pmo)
   at dataFileReadtoMQ.Module1.Main(String[] CmdArgs) in C:\Documents and Settings\mtaylor\My Documents\Visual Studio 2005\Projects\dataFileReadtoMQ\dataFileReadtoMQ\Module1.vb:line 90"
    TargetSite: {System.Reflection.RuntimeMethodInfo}
Back to top
View user's profile Send private message AIM Address
Vitor
PostPosted: Mon Oct 02, 2006 5:29 am    Post subject: Reply with quote

Grand High Poobah

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

A few moments with the documentation will reveal that 2053 is "queue full".

I suspect whatever's reading QUEUE1 a) isn't working properly b) isn't working fast enough

A third possibility is that the maximum depth of QUEUE1 is set too low, but that's a bit unlikely.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » catching an exception i don't want to catch
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.