# STOMP support

**URL:** <https://swi-prolog.discourse.group/t/stomp-support/3853>\
**Category:** Request For Comments\
**Created:** [April 22, 2021, 9:52am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853 "2021-04-22T09:52:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 22, 2021, 9:52am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853/1 "2021-04-22T09:52:00Z")

</div>

With a customer we are looking how to connect Prolog to RabbitMQ for relatively low-traffic communication. We stumbled on [STOMPL](https://github.com/honnix/stompl) by @honnix. That didn’t really work anymore. I forked it and did some serious rewrites to simplify the STOMP frame (de)serialization, simplify the API and work towards lazy connection establishment (done) and automatic reconnect (not yet done). The new code is at [GitHub - JanWielemaker/stompl: Prolog STOMP client](https://github.com/JanWielemaker/stompl)

I think there are several more things that can be improved. Notably for ACK and NACK messages we can probably just pass the original message header? Eventually I plan to add this to the standard SWI-Prolog distribution as it is both pretty useful and small. Together with the Redis and ROS interfaces we build proof that Prolog can integrate into modern micro services architectures.

Is there anyone with concrete experience using STOMP who is willing to have a look at the current state and see what is missing, can be simplified/improved, etc.? Also, what is needed to deal with version 1.2 of the STOMP protocol?

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [April 22, 2021, 9:57am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853/2 "2021-04-22T09:57:47Z")

</div>

Interest,

I have been recently using websockets to connect Prolog and other clients.

I am curious – why stomp vs. WebSockets – which is already supported …

---

<div class="post-metadata">

**Author:** ![honnix](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/honnix/32/30_2.png) [@honnix](https://swi-prolog.discourse.group/u/honnix)\
**Post date:** [April 22, 2021, 10:10am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853/3 "2021-04-22T10:10:13Z")

</div>

@jan Thanks for the fork and improvement. I have completely lost my memory how this works unfortunately, so I can’t help much.

@grossdan Yeah if websocket is now the better way connecting to RabbitMQ, maybe we should use that instead. I might be wrong (too many years), but when this was written there wasn’t good support of websockets, and stomp was a good option.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 22, 2021, 10:46am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853/4 "2021-04-22T10:46:50Z")

</div>

@honnix Thanks for the code. I reimplemented a lot, but given your starting point that was a lot less work than figuring out the STOMP protocol and implement from scratch.

P.s. If it moves into the standard distribution I would prefer to relicense under BSD-2 to keep the license as simple as possible. Would you agree with changing the license?

Websockets are a more low level protocol. They merely provided message delimiting and very limited meta-data on top of a stream. A STOMP frame consists of a command, arbitrary set of name/value pairs and an arbitrary body. On top of that, STOMP specifies how to subscribe to topics, how to combine multiple messages in a single transaction and a few more of these.

---

<div class="post-metadata">

**Author:** ![honnix](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/honnix/32/30_2.png) [@honnix](https://swi-prolog.discourse.group/u/honnix)\
**Post date:** [April 22, 2021, 11:02am UTC](https://swi-prolog.discourse.group/t/stomp-support/3853/5 "2021-04-22T11:02:54Z")

</div>

@jan Yes, absolutely OK, BSD-2 sounds good to me. I’m super excited to see this code could serve something much useful than my prototype project years back. 🙂 I will go ahead archive my repo because it is not working anyway, and refer to your fork.

Thanks for explaining what websockets offer.
