|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Serialized object in C |
« View previous topic :: View next topic » |
Author |
Message
|
gmabrito |
Posted: Wed Mar 20, 2002 2:56 pm Post subject: |
|
|
 Apprentice
Joined: 19 Mar 2002 Posts: 35
|
I am trying write a program to handle a serialized object in C. Actually I would like this program to handle any kind of object within the queue. I want to be able to MQGET the message off a queue and print it to standard out, so I can redirect it to a file or pipe it to another program to put it on another queue. I tried using the defined MQBYTE array to handle this message data but it looks like it truncates the message when it gets to the serialized object. Any help would be appreciated.
Thanks,
Greg |
|
Back to top |
|
 |
mrlinux |
Posted: Thu Mar 21, 2002 6:58 am Post subject: |
|
|
 Grand Master
Joined: 14 Feb 2002 Posts: 1261 Location: Detroit,MI USA
|
Are you getting a REason code of 2080 ????
_________________ Jeff
IBM Certified Developer MQSeries
IBM Certified Specialist MQSeries
IBM Certified Solutions Expert MQSeries |
|
Back to top |
|
 |
gmabrito |
Posted: Thu Mar 21, 2002 7:41 am Post subject: |
|
|
 Apprentice
Joined: 19 Mar 2002 Posts: 35
|
No. I checked for that error code.
_________________ Thanks,
Greg |
|
Back to top |
|
 |
kolban |
Posted: Wed Mar 27, 2002 8:28 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
|
What makes you think the message was truncated? The content of the message is a red-herring. MQ by iyself doesn't care what is in the message. With a serialized C object as a message on the queue, use the MQExplorer browser to see how long the message is. Then, in your application, get the message and print out the length of the message returned. They should be the same. Ensure that you supply a buffer to the MQGET call large enough to hold your maximum expected message. |
|
Back to top |
|
 |
StefanSievert |
Posted: Wed Mar 27, 2002 10:33 am Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
Hmmm, what are we talking about here? You say 'C' and you say 'serialized object'...!? Can you be a bit more specific about the scenario? Are you having an OO-Language (Java, C++, ??) written program on the sending side that serializes an object and puts the data to a queue, and a C (non-OO) program at the other end, that should handle the serialized object as binary data?
If this is the case and you talk about truncation, then I immediately think of C str.../printf functions and Hex Nulls. But as I really don't fully understand what you are tying to do, it might be totally off track.
I would at least assume that serialized objects WILL contain binary zeroes, so you might have trouble redirecting to stdout.
Cheers,
Stefan
_________________ Stefan Sievert
IBM Certified * WebSphere MQ |
|
Back to top |
|
 |
gmabrito |
Posted: Wed Mar 27, 2002 10:47 am Post subject: |
|
|
 Apprentice
Joined: 19 Mar 2002 Posts: 35
|
YES. That is exactly the case. A Java program is creating the object, I just want to handle it, but I do not want to create a structure or data type to mimic the object. I just want to take whatever is in the queue remove it. I want my program to be generic enough so that the user can redirect the ouput to a file, to load to the queue later or pipe the output to another program to load it on a different queue.
|
|
Back to top |
|
 |
StefanSievert |
Posted: Wed Mar 27, 2002 2:09 pm Post subject: |
|
|
 Partisan
Joined: 28 Oct 2001 Posts: 333 Location: San Francisco
|
Thanks for the clarification. I guess in that case you have to be very careful about which C functions you use to handle the serialized object (BLOB), because of the aforementioned probability that the BLOB contains 0x00 values which are significant for some library functions (string handling, printf, sprintf, fprintf, etc.).
I still think that one of those NULLs is why you see a truncation. You could verify this by using a debugger to see what the message buffer after the MQGET contains at the position where the truncation occurs.
If I would be a gambling man...
Cheers,
Stefan
_________________ Stefan Sievert
IBM Certified * WebSphere MQ |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|