support for Stomp protocol

6 views
Skip to first unread message

Jack Zai

unread,
Jul 11, 2007, 7:04:29 AM7/11/07
to phpsam
Hi all,

I've developed a new support for ActiveMQ using Stomp [1] protocol. My
code uses the existing Stomp client for PHP [2], the library provides
socket connectivity and API for generating stomp commands. The file
is licensed under Apache license v2, and I've modified it slightly, I
am not sure is there any problems with redistribution of this file?

The Stomp client itself does not provide support to all of the SAM API
functions. For example, there is no receive command for stomp, but we
can code it as a sequence of stomp commands (something like subscribe -
> readFrame -> acknowledge -> unsubscribe). so basically, my code sits
between the Stomp client and the SAM API, mapping between SAM
constants and stomp headers.

Also, Stomp receives messages passively, i.e. messages are sent to
clients as it arrives at the broker, so there is a potential risk of
socket buffer overflow. Fortunately, we can tell ActiveMQ to send out
one message at a time by setting a stomp header activemq.prefetchSize
to 1. However, if more than one subscriptions are made, the order of
messages arrived at client may be different from user would expect. so
my code has a runtime buffer that temporarily holds messages which are
not yet consumed by the client.

I've implemented most of SAM API functions except peekall and remove
(can use receive instead). In addition, I've also written three
testcases (examples) for p2p, pub/sub and transaction support
respectively. If anyone interested or have any questions, please let
me know.

Jack

Reference:
[1] Stomp site http://stomp.codehaus.org/
[2] Stomp client for PHP http://stomp.codehaus.org/PHP

Reply all
Reply to author
Forward
0 new messages