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 » General IBM MQ Support » URGENT!! Triggering problem

Post new topic  Reply to topic
 URGENT!! Triggering problem « View previous topic :: View next topic » 
Author Message
chillu71
PostPosted: Sun Sep 21, 2003 8:51 am    Post subject: URGENT!! Triggering problem Reply with quote

Newbie

Joined: 21 Sep 2003
Posts: 4

Hi,
We have this trigger defined for queue Q1. Trigger type is 'EVERY' and everything else is default. When trigger monitor is running, messages arriving in Q1 are getting processed without any problem. When trigger monitor is stopped, messages arrive in Q1. Problem arises when we restart trigger monitor, messages already available in Q1 does not get processed (sometimes few messages get processed). And when a new message arrives, last message in Q1, prior to the new message, gets processed. Likewise, for every new message arriving, last message from the previous PUT, while the trigger monitor was turned off, gets processed. Could someone explain what’s going on and how to fix this problem? Thanks in advance.

Chillu
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Sun Sep 21, 2003 4:23 pm    Post subject: Re: URGENT!! Triggering problem Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

chillu71 wrote:
Hi,
We have this trigger defined for queue Q1. Trigger type is 'EVERY' and everything else is default. When trigger monitor is running, messages arriving in Q1 are getting processed without any problem. When trigger monitor is stopped, messages arrive in Q1. Problem arises when we restart trigger monitor, messages already available in Q1 does not get processed (sometimes few messages get processed). And when a new message arrives, last message in Q1, prior to the new message, gets processed. Likewise, for every new message arriving, last message from the previous PUT, while the trigger monitor was turned off, gets processed. Could someone explain what’s going on and how to fix this problem? Thanks in advance.


This is what is supposed to happen. Trigger every only causes a trigger message to be written when the queue depth increases, not once for every message on the queue. Your application is written to read the first message off the queue. If there are ten messages on the queue, and then another message appears, your application will still read the first message, not the eleventh.

You should recode your application to process every message on the queue when it runs. Or put a process in place to run your application once for each message on the queue when the trigger monitor starts up.
Back to top
View user's profile Send private message
chillu71
PostPosted: Mon Sep 22, 2003 6:15 am    Post subject: Triggering Reply with quote

Newbie

Joined: 21 Sep 2003
Posts: 4

Thank you. Could you let me know an example to set up a process that would run for each message when trigger monitor statrs up? Thanks in advance.

Chillu
Back to top
View user's profile Send private message
mrlinux
PostPosted: Mon Sep 22, 2003 9:59 am    Post subject: Reply with quote

Grand Master

Joined: 14 Feb 2002
Posts: 1261
Location: Detroit,MI USA

The best solution is to have the application that gets triggered read the queue until empty then exit.
_________________
Jeff

IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries
Back to top
View user's profile Send private message Send e-mail
chillu71
PostPosted: Wed Sep 24, 2003 8:12 am    Post subject: Triggering New Issue Reply with quote

Newbie

Joined: 21 Sep 2003
Posts: 4

Hi,
I changed my trigger application to read messages until queue is empty. Message data is empty when a message arrives in the queue while trigger is running. I stop the trigger and restart it, i could read message data. Why this is happening. Any suggestions. Thanks!

Chillu
Back to top
View user's profile Send private message
mrlinux
PostPosted: Wed Sep 24, 2003 11:50 am    Post subject: Reply with quote

Grand Master

Joined: 14 Feb 2002
Posts: 1261
Location: Detroit,MI USA

I dont understand your question ???? are you saying that if you stop the trigger program you can still see data in the queue ??? or are you saying something different ???
_________________
Jeff

IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries
Back to top
View user's profile Send private message Send e-mail
chillu71
PostPosted: Wed Sep 24, 2003 2:02 pm    Post subject: URGENT:Triggering Reply with quote

Newbie

Joined: 21 Sep 2003
Posts: 4

Hi,
Actuall I have 2 issues after doing some further testing.
A. Testted with 1 message:
I loop through the messages. For each message I get the message ID and message data/value. When a message arrives, control goes into the loop, then I try to get message data for each message. This message data is empty. To make sure that messages have data, I stopped trigger monitor and PUT a message. Message arrives in the queue. I edit the properties of the message and could see data.

B.Multiple messages:
Trigger monitor is running.
Multiple messages arrive at the queue
Trigger gets fired
Only few (usually last 1 message) gets processed and for remaining messages program gets errored out because no message data found in the message to process.

If it helps, I am pasting my function below. let me know if you need further info

Private Sub Main()


On Error GoTo Error

Dim MQMgr As New MQQueueManager 'MQ manager object
Dim MQSess As New MQSession 'session object
Dim MQ As MQQueue 'input MQ object
Dim GetOptions As MQGetMessageOptions 'get message options
Dim GetMsg As MQMessage

Dim dBeginTime As Date
Dim iTimeOut As Integer
Dim ArrCommand() As String
Dim strMsg As String
Dim sLocalQMgr As String
Dim sQMgr As String
Dim sMsgQName As String
Dim sReplyToQ As String
Dim sMsgPayload As String
Dim sMessageID As String

Dim oServerConnector As Object
Dim oServerAdapter As Object

Set oServerConnector = CreateObject("ServerConnector.cServerConnector")
dBeginTime = Now
iTimeOut = 30 'IIf(CInt(TimeOut) = 0, 15, CInt(TimeOut))
ArrCommand = Split(Command, ";")
If ArrCommand(0) = "" Then
Err.Raise vbObjectError + 500, , "No command arguments found"
Exit Sub
End If
sLocalQMgr = ArrCommand(0)
'sReplyToQ = Trim$(Left$(ArrCommand(1), InStr(1, ArrCommand(1), " ", vbTextCompare)))
sMsgQName = Trim$(ArrCommand(1))

'Raise the ExceptionThreshold value, in case there is an error ,
'the application will continue instead of going to Error Handler
MQSess.ExceptionThreshold = 3
Set MQMgr = MQSess.AccessQueueManager(sLocalQMgr)
MQSess.ExceptionThreshold = 2

'Any error
If MQSess.ReasonCode <> MQRC_NONE Then
Call LogStatus("Error connecting to QMgr. Reason code: " & MQSess.ReasonCode)
Err.Raise vbObjectError + 500, , "Error to connect to the Queue Manager."
End If

MQSess.ExceptionThreshold = 3
Set MQ = MQMgr.AccessQueue(sMsgQName, MQOO_INPUT_AS_Q_DEF)
MQSess.ExceptionThreshold = 2

'Any error
If MQSess.ReasonCode <> MQRC_NONE Then
Call LogStatus("Error connecting to Q. Reason code: " & MQSess.ReasonCode)
Err.Raise vbObjectError + 500, , "Error to connect to the queue."
End If
'Set Get Options
Set GetOptions = MQSess.AccessGetMessageOptions()
GetOptions.Options = MQGMO_WAIT + MQGMO_SYNCPOINT + _
MQGMO_ACCEPT_TRUNCATED_MSG 'Mark the message without deleting after it's read

Set GetMsg = MQSess.AccessMessage()


'If the message is not there yet, keep trying until time out
While (DateDiff("S", dBeginTime, Now) < iTimeOut And MQSess.ReasonCode <> 2033)
'Set Get Message
If GetMsg.MessageId <> "" Then
'GetOptions.MatchOptions = MQMO_MATCH_MSG_ID
'GetMsg.MessageID = Me.MessageID
GetOptions.MatchOptions = MQMO_MATCH_CORREL_ID
GetMsg.CorrelationId = GetMsg.MessageId
End If

MQSess.ExceptionThreshold = 3
MQ.Get GetMsg, GetOptions
MQSess.ExceptionThreshold = 2
'Pass the data to MessagePayLoad
sMsgPayload = GetMsg.MessageData

If sMsgPayload = "" Then
Call LogStatus("No Payload:")
Err.Raise vbObjectError + 500, , "No input payload found for message id - " & GetMsg.MessageId
Else
Set oServerAdapter = CreateObject("AdapterServer.cAdpServer")
Call LogStatus("After calling server adapter")
If GetMsg.ReplyToQueueManagerName <> "" And GetMsg.ReplyToQueueName <> "" Then
sQMgr = GetMsg.ReplyToQueueManagerName
sReplyToQ = GetMsg.ReplyToQueueName
sMessageID = GetMsg.MessageId
End If
oServerAdapter.LocalQueueManagerName = sLocalQMgr
oServerAdapter.MessagePayLoad = sMsgPayload
oServerAdapter.MQQueueManager = sQMgr
oServerAdapter.MQQueue = sReplyToQ

If oServerAdapter.Execute_Service() > 0 Then
Call LogStatus("Execute_Service > 0:")
oServerConnector.QueueManagerName = sQMgr
oServerConnector.SendToQueueName = sReplyToQ
oServerConnector.MessagePayLoad = oServerAdapter.ObjErrMsg

Call oServerConnector.IConnector_Send("")
MQMgr.Commit
End If
End If

Set oServerAdapter = Nothing
Wend

'Commit the message
MQMgr.Commit
MQ.Close
MQMgr.Disconnect
Set MQMgr = Nothing
Set MQSess = Nothing
Set MQ = Nothing
Set GetOptions = Nothing
Set GetMsg = Nothing

Exit Sub

Error:
Call LogStatus("Error: " & Err.Description)
oServerConnector.QueueManagerName = sQMgr
oServerConnector.SendToQueueName = "davidtest"
oServerConnector.MessagePayLoad = Err.Description

Call oServerConnector.IConnector_Send("")

Set oServerAdapter = Nothing

strMsg = Err.Description
If MQSess.ReasonCode <> 0 Then
Call LogStatus("Commiting. Reason: " & MQSess.ReasonCode)
MQMgr.Commit
End If
Set MQMgr = Nothing
Set MQSess = Nothing
Set MQ = Nothing
Set GetOptions = Nothing
Set GetMsg = Nothing
End Sub
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Sep 25, 2003 5:51 am    Post subject: Re: URGENT:Triggering Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

chillu71 wrote:
GetOptions.Options = MQGMO_WAIT + MQGMO_SYNCPOINT + _
MQGMO_ACCEPT_TRUNCATED_MSG 'Mark the message without deleting after it's read


That's not what MQGMO_ACCEPT_TRUNCATED_MSG does. Accept Truncated message means that you will destructively read the message on the queue, and only take a piece of the message that is the size of the buffer you supply.

If you want to NONdestructively get a message, then you need to use MQGMO_BROWSE_FIRST and MQGMO_BROWSE_NEXT.
_________________
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 » General IBM MQ Support » URGENT!! Triggering problem
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.