Author |
Message
|
swood |
Posted: Tue Jan 18, 2005 5:55 pm Post subject: Lost message |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
I am getting a connection from MQ using the .NET client classes. I need to put a message in a 'Header' queue and then put a message in a 'Data' queue. This is the flow:
1. Get a queue manager. Works fine.
2. Open the 'Header' queue and put a message in the queue. Works fine. Customer recieves this.
3. Open the 'Data' queue and put a message in the queue. No errors, completion code of 0. Customer doesn't recieve this.
4. Disconnect from the queue manager.
My component has a connect method that sets it's queue manager and this works fine. It also has a sendMessage method that is called twice, once for the 'Header' message and once for the 'Data' message, and the queue name and message text is passed into the method. This method calls AccessQueue using the queue name passed in, global QM, and puts the message without any errors generated. Globally instantiated QM shows isconnected for each putMessage call.
Is there something I'm missing... I don't think I need to create a new QM for each message...I imagine that it is okay to open two queues with the same queue manager...am I supposed to call commit between puts or something like that?
Any ideas? _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 18, 2005 7:46 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Depends on your options:
are you using syncpoint. If yes a commit would be in order.
I would make sure that before changing queue I disconnect from the current queue.
Enjoy  |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jan 19, 2005 6:14 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
fjb_saper wrote: |
I would make sure that before changing queue I disconnect from the current queue. |
You shouldn't have to 'disconnect' (did you mean close) each queue just to put a message onto another queue. I doubt this is your problem. Also, if both messages need to be put together (or not put together), then you ought to put them in the same unit of work. |
|
Back to top |
|
 |
swood |
Posted: Wed Jan 19, 2005 6:30 am Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
I agree about the connection and I tested locally on a server with the everything set up the same except the ip of course. I can put both messages in the queues like it is supposed to.
Could you tell me what is meant by the same unit of work. The first message sent contains information about how to process the second message sent to the other queue. They really do rely on each other. The messageID from the first message in the Header queue is placed in the correlationid of the corresponding Data messages. I will need to roll back the insert into the Header queue if the Data queue fails.
Here is my put Function:
Public Function PutMessage(ByVal message As String, ByVal QueueName As String, ByVal CorrelationID As Byte()) As Byte()
If IsNothing(_QM) Then Connect()
If Not IsNothing(_QM) AndAlso _QM.IsConnected = True Then
_pmo = New MQPutMessageOptions()
_pmo.Options = 0
_pmo.Options = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING
_Msg = New MQMessage() 'create a buffer to hold the outgoing message
With _Msg
.MessageId = MQC.MQCI_NONE
.CorrelationId = IIf(IsNothing(CorrelationID), MQC.MQCI_NONE, CorrelationID)
.Feedback = MQC.MQFB_QUIT
.Expiry = -1
.Format = MQC.MQFMT_STRING
.CharacterSet = 1208
.MessageType = MQC.MQMT_DATAGRAM
.Persistence = MQC.MQPER_PERSISTENT
.Priority = 0
.WriteString(message)
End With
Try
Dim _Queue As MQQueue = _QM.AccessQueue(QueueName, _pmo.Options) 'MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)
_Queue.Put(_Msg)
Catch mqError As MQException
Throw New Exception(mqError.ReasonCode, mqError)
Catch AppError As Exception
Throw New Exception(AppError.Message)
Finally
If Not IsNothing(_Msg) Then PutMessage = _Msg.MessageId
Dim completionCode As Integer = _QM.CompletionCode()
_Msg = Nothing
End Try
Else
Throw New Exception("Queue Manager lost in Put")
End If
End Function _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jan 19, 2005 8:44 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I'm not a .NET person, but there should be a PMO flag that allows you to specify the message is in syncpoint (in C: MQPMO_NO_SYNCPOINT). You would use this for both messages. You would then use the MQCMIT on the qmgr object to commit all outstanding units of work. |
|
Back to top |
|
 |
swood |
Posted: Wed Jan 19, 2005 9:08 am Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
Thanks,
I have set the SYNCHPOINT in this way:
Dim synchPmo As MQPutMessageOptions = New MQPutMessageOptions()
synchPmo.Options = MQC.MQPMO_SYNCPOINT
_Queue.Put(_Msg, synchPmo)
My application that uses my connector component is a windows service. It puts two messages to two different queues using this method. All errors are managed in the windows service and if any are found, it calls the Queue Manager's BackOut(). If all is well it calls the Queue Manager's commit() method.
Is this acceptable, it almost sounds too easy compared to setting this up in the first place. _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jan 19, 2005 10:26 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
It sounds like you have everything set correctly. Did you actually run your program to see what it does? |
|
Back to top |
|
 |
swood |
Posted: Wed Jan 19, 2005 10:57 am Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
Yes, using the demo of mq series locally this is the flow:
-Customer uploads data to our db at any time which also adds entry to our db queue.
-Windows service,running already, has read params for MQ Series setup from MQSettings.DLL or config file.
-On specified hour Timer checks db Queue table for entries every X seconds
-Get parameters from my DB Queue table if status field has no reason code
-Connect to the QM ( try the specified amount of times before throwing error to win service which will in turn notify tech support by email)
-Extract data from our db
-Create message for Header queue using the params from the db queue
-Create message for Data queue using the params from the db queue
-Put message in the Header queue
-Put message in the Data queue using Header message's id as correlationid in Data message( if error then backout Header message)
-Remove entry from my db queue ( if error then backout Data & Header message)
-Email error messages to tech support when they occur
-If other than connection error...log reason code as status in db queue entry (stops uploading file because of structural error or such)
-Tech support logs into admin page and can change status field to try message again.
-so far anyway
All this works on the customer's server exept putting the message into the Data queue, probably a config error in their queue but.... _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
swood |
Posted: Sat Jan 22, 2005 10:53 am Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
I found the lost messages. The customers queue was set to recieve no messages larger than 4096 bytes and ours was 20480 bytes. They were going into the dead letter queue. I am surprised I didn't get an error back or something though. We are going to split the file up into 5 messages. _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
EddieA |
Posted: Sat Jan 22, 2005 1:26 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
I am surprised I didn't get an error back or something though |
Why. MQ is asynchronous messaging. Your PUT worked.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
swood |
Posted: Sat Jan 22, 2005 1:57 pm Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
Sorry,
I have only been using the MQ for a couple of months. I realize it got there but I thought I would get a warning about message size larger than queue size or something like that. _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
kirani |
Posted: Sun Jan 23, 2005 4:14 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Well, your message is not really lost. It's sitting in the DLQ on the other queue manager. This queue is like an exception queue and some process (or someone) is supposed to watch this queue. Under normal circumstances there should not be any mesages on this queue.
You can also think of increasing the maximum message length for the queue. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
PeterPotkay |
Posted: Sun Jan 23, 2005 7:19 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
When you put the message, set the Exception Report flag in the MQMD_Report field. If ther destination QM can't put the message to the intended queue for any reason, you will get a report message back saying why. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
swood |
Posted: Thu Jan 27, 2005 8:10 am Post subject: |
|
|
Novice
Joined: 10 Dec 2004 Posts: 20
|
Thanks everyone,
I didn't know I could set the report flag when using the client. I get an error about not setting the reply-to queue, which I don't think I can create for access, using the client. Alternatively I could ask the customer to create a results/status queue on their MQ Server and I could check that to see if everything was ok with the various stages of the message processing. _________________ I don't know as much as I wish I did. |
|
Back to top |
|
 |
Priya Raghunath |
Posted: Wed Feb 16, 2005 10:55 pm Post subject: Why you need to split the message. |
|
|
Newbie
Joined: 24 Jan 2005 Posts: 5
|
Hi Swood,
Can you please tell me why you should split the messages into 5 parts.
Is your requirement so.
Priya. |
|
Back to top |
|
 |
|