[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Handling Large Messages
ataylor
do-not-reply at jboss.com
Thu Jul 10 09:21:34 EDT 2008
anonymous wrote : I think we should extend the concept of splitting packets into fragments to other packets too - not just message sends and receives, since other packets have the possibility (however unlikely) of getting large, since there are not fixed length fields like address names in them.
yeah so the 1st way i suggested would do this. basically the encode method of PAcketImpl would be something like:
| public void encode(MessagingBuffer buffer)
| {
| //The standard header fields
| buffer.putInt(0); //The length gets filled in at the end
| buffer.putByte(type);
| buffer.putLong(responseTargetID);
| buffer.putLong(targetID);
| buffer.putLong(executorID);
| buffer.putInt(correlationId);
| buffer.putBoolean(isLastMessage);
| //if we are a small message
| if(!isMultiPartMessage())
| {
| encodeBody(buffer);
| }
| else
| {
| //else write the body to a cache and for each send only write 1k of body to the message
| if(correlationId == 0)
| {
| bodyCache = buffer.createNewBuffer(1024);
| encodeBody(bodyCache);
| }
| buffer.putBytes(bodyCache.array(), correlationId * 1024, 1024);
| }
|
| //The length doesn't include the actual length byte
| int len = buffer.position() - DataConstants.SIZE_INT;
|
| buffer.putInt(0, len);
|
| buffer.flip();
| }
|
Then we just keep on sending the same message but with the next part of the body.
anonymous wrote :
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163599#4163599
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163599
More information about the jboss-dev-forums
mailing list