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 » WebSphere Message Broker (ACE) Support » Receiving variable length message over TCPIP

Post new topic  Reply to topic
 Receiving variable length message over TCPIP « View previous topic :: View next topic » 
Author Message
mjain
PostPosted: Tue Sep 04, 2012 6:42 am    Post subject: Receiving variable length message over TCPIP Reply with quote

Novice

Joined: 01 May 2012
Posts: 15

Hi,
I have a message flow which sends data to remote host over TCPIPCLientOutput node and receives the response through TCPIPClientReceive node. The response is not a fixed length data but message length is sent in first four bytes. Also the remote host does not close the connection once it is done sending the response data. Now if I set property "Record Detection" of ClientReceive node as Closed Connection, it always times out and I cant set same to Parsed Record Sequence a I want to receive data in BLOB. Is there any way we can receive variable length data in BLOB format?....Is there any way I can use the first four bytes to know the length of response?. Any help is appreciated.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Sep 04, 2012 6:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't say if the record is terminated by a delimiter. You should double-check that.

it's also dead-easy to create a message model that contains a 4 byte field and a blob string where the length of the blob is determined by the 4 byte field.
Back to top
View user's profile Send private message
PEPERO
PostPosted: Tue Sep 04, 2012 9:55 pm    Post subject: Reply with quote

Disciple

Joined: 30 May 2011
Posts: 177

You could use two receive nodes. the first one reads the 4 byte binary message length. Using a transformation node you could set the message length property of the second TCPIPRECEIVE node dynamically with in the localenvironment tree structure.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Sep 04, 2012 10:25 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

PEPERO wrote:
You could use two receive nodes. the first one reads the 4 byte binary message length. Using a transformation node you could set the message length property of the second TCPIPRECEIVE node dynamically with in the localenvironment tree structure.


This is a pretty common scenario.
The 1st node gets the leght information and then after converting it into an integer puts it into the LocelEnvironment and passes it onto the the second node. something like this may do the job.

Code:

CREATE COMPUTE MODULE My_Flow_Extract_TCPIP_Length
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      declare cLength char;
      set cLength = cast(InputRoot.BLOB.BLOB as char CCSID 1208);
      set OutputLocalEnvironment.TCPIP.Receive.Length = trim(right(cLength,4));
      RETURN TRUE;
   END;

_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mjain
PostPosted: Tue Sep 04, 2012 11:48 pm    Post subject: Reply with quote

Novice

Joined: 01 May 2012
Posts: 15

Thanks Pepero....
Even I thought of same way and was succesfully able to test it as well. But I was not sure if its good way to have two receive nodes.
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 » WebSphere Message Broker (ACE) Support » Receiving variable length message over TCPIP
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.