Packet Question

1 view
Skip to first unread message

jayrodau

unread,
Mar 15, 2010, 2:33:22 PM3/15/10
to MorbidQ
What is the max size the Stomp packet can be when publishing packets?
Or what is the max size of the body portion of the message?

Thanks,
Jared

Whitesell, Ken

unread,
Mar 15, 2010, 2:42:00 PM3/15/10
to mor...@googlegroups.com
MorbidQ places no limits on the message size that I can see. If there is a limit, it would be imposed by Orbited. Just remember that MorbidQ keeps all messages in memory, so it would be possible to really tie it into knots that way.

> --
> You received this message because you are subscribed to the
> Google Groups "MorbidQ" group.
> To post to this group, send email to mor...@googlegroups.com.
> To unsubscribe from this group, send email to
> morbidq+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/morbidq?hl=en.
>
>
>

Jared Wilson

unread,
Mar 15, 2010, 2:48:14 PM3/15/10
to mor...@googlegroups.com
Hmm....I have success if I send just a normal string within the body portion of the message.

Now I am going beyond and trying to shove another packet inside of the the body portion of the stomp message and getting a error:
Failure instance: Traceback (failure with no frames)
(class 'twisted.internet.error.Connectiondone')

Any ideas?

Whitesell, Ken

unread,
Mar 15, 2010, 3:08:18 PM3/15/10
to mor...@googlegroups.com
Do you have a sample of the message you're trying to send?
 
I was browsing through the code in StompBuffer.py, where I see that it's using a regex to parse the message. If you've got a complete message inside another message, I would imagine it could possibly cause a problem there.
 
 


From: mor...@googlegroups.com [mailto:mor...@googlegroups.com] On Behalf Of Jared Wilson
Sent: Monday, March 15, 2010 2:48 PM
To: mor...@googlegroups.com
Subject: Re: Packet Question

Jared Wilson

unread,
Mar 15, 2010, 3:17:46 PM3/15/10
to mor...@googlegroups.com
The message I am trying to embed we have an api we have written. It is basically a message in all bytes.

value = random.randint(0, 100)

pkt = PKTv1()       

pkt.instance = 4

pkt.user_data = "['Model1', '%s', 'Volts']" % (value)

newData = "%s" % (str(pkt))

self.send(CHANNEL_NAME, newData)


I just read that there this:

To send a BytesMessage, you should set the field 'bytes_message' to 1.

Im not sure how to pass this in to the send??


Thanks,

Jared

Whitesell, Ken

unread,
Mar 15, 2010, 3:29:55 PM3/15/10
to mor...@googlegroups.com
Are you saying that you're sending a raw binary stream as a message? ("a message in all bytes") Or are you sending the ascii representation of that data?
 
It would really help to see a sample of what newData looks like when being sent.
 
Thanks,
    Ken


From: mor...@googlegroups.com [mailto:mor...@googlegroups.com] On Behalf Of Jared Wilson
Sent: Monday, March 15, 2010 3:18 PM

Jared Wilson

unread,
Mar 15, 2010, 3:36:38 PM3/15/10
to mor...@googlegroups.com
You are correct sorry...I had my terms mixed up.
newData is a raw binary stream.

Whitesell, Ken

unread,
Mar 15, 2010, 3:43:34 PM3/15/10
to mor...@googlegroups.com
Ok, that's what I was afraid you were going to say.
 
Although the stomp protocol specifies ways to handle a binary message, neither stomper nor Morbid are really coded expecting that to be the case. It may be possible to get that to work, but I don't see it being an easy task.
 
If you really need to send raw binary through as a message, I would suggest encoding it as a base64 string before being sent, then decoding it at the destination. That's going to be far easier than trying to make the server components "binary safe".


From: mor...@googlegroups.com [mailto:mor...@googlegroups.com] On Behalf Of Jared Wilson
Sent: Monday, March 15, 2010 3:37 PM

Jared Wilson

unread,
Mar 15, 2010, 3:55:55 PM3/15/10
to mor...@googlegroups.com
So, something like this?
import base64


data = "%s" % (str(pkt))
newData = base64.b64encode(data)

self.send(CHANNEL_NAME, newData)


Decoding at destination:

base64.b64.b64decode(data)


Thanks,

Jared

Whitesell, Ken

unread,
Mar 15, 2010, 4:03:13 PM3/15/10
to mor...@googlegroups.com
Or slightly more simply:
 
at sender:
 
from base64 import b64encode
 
newData = b64encode(str(pkt))
self.send(CHANNEL_NAME, newData)
 
receiver:
 
from base64 import b64decode
 
data = b64decode(msg)
 
Should be all you need.

From: mor...@googlegroups.com [mailto:mor...@googlegroups.com] On Behalf Of Jared Wilson
Sent: Monday, March 15, 2010 3:56 PM

Jared Wilson

unread,
Mar 15, 2010, 4:04:22 PM3/15/10
to mor...@googlegroups.com
Yep that worked!!

Thank you so much!!

-Jared
Reply all
Reply to author
Forward
0 new messages