How Do I Trap Messaging Errors? (Magic xpa 3.x)

Whenever you use one of the MSMQ programs, there is the possibility that it will raise an error. Each of the programs has a return code that you can query, however, you can also use an Event handler to automatically trap MSMQ errors. To add this event:
-
Open the task you want to handle the MSMQ error. This can be in three different locations:
-
Click on the Logic tab.
-
Press Ctrl+H (Edit->Create Header Line) to create a new Logic header line.
-
Type E to create an Event. The Event dialog box will appear.
-
Choose Event type of User.
-
Zoom from the Event field to choose MSMQ.Public error.
-
Click OK. You will get a dialog box that says “Create Parameter variables to match parameters in the event?”. Select Yes.
-
The Event handler will be created, complete with parameters.
-
Choose the Scope that applies in this case.
-
Use the parameter variables as needed to handle the error. In our example we used the message text to create a user error message.
The Event has four parameters:
|
|
pO.Messaging system
|
-
M - MSMQ
-
J - JMS
-
W - WebSphere MQ
|
pO.Error code
|
The error code.
|
pO.Validation Error?
|
TRUE if the error is from the MSMQ component’s validation check.
FALSE if there was an error during execution.
|
pO.Error message
|
The error text.
|
Note: While you can trap all the error messages here, remember that they are also written to the message error log. The location of this log is specified under MessagingComponentDir in the Logical Names section.