akka / alpakka

Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
https://doc.akka.io/docs/alpakka/current/
Other
1.26k stars 646 forks source link

STOMP support #514

Open ktoso opened 6 years ago

ktoso commented 6 years ago

Being able to expose STOMP streams https://stomp.github.io/stomp-specification-1.2.html

I've heard this request and agree could be pretty useful, but we can't dedicate someone to work on it now - if someone would like to pick it up that would be excellent :)

ktoso commented 6 years ago

We could pay special attention to ack modes: https://stomp.github.io/stomp-specification-1.2.html#SUBSCRIBE_ack_Header

This seems to be something camel is not able to expose

gosubpl commented 6 years ago

I can try to take a stab at it, but cannot promise I will be done before New Year. Would that be fine for you?

And yes, ACK modes are important for STOMP :)

ktoso commented 6 years ago

Sure, please give it a shot :)

nachinius commented 6 years ago

@gosubpl, what's the state of this?

gosubpl commented 6 years ago

@nachinius haven't yet started. Quite busy recently. If you want to give it a shot - please do, I can help reviewing.

nachinius commented 6 years ago

Ok, let's see if we are in the same page.

I can imagine several ways to use stomp in akka streams, the two most basic I think of are StompSink and StompSource. The descriptions of what they do are:

On start both StompSink and StompSource, requires a Connection to a stomp server. The StompSource also requires, at start, a topic to subscribe to.

backpropagation

In the consumer (source), we can use stomp's ACK to acknowledge processing, as a way to implement backpropagating. For the producer (sink) we can request stomp header RECEIPT to achieve the same purpose. Both of these, are set by our end, so they could be controlled by settings. I suggest ON by default.

heartbeats

I would leave this, for a following iteration, or even after implementing the stomp server endpoints (see below).

protocol

For the protocol implemenation, I found vertx-stomp which is an eclipse foundation project, licensed under both eclipse license and apache license. No need to repeat the protocol here. It's the only one I found to be complete and able to handle 1.2.

second version, StompServerSource and StompServerSink

Another way to use stomp in akka, that could fit a subsequent version, is implementing Sources and Sink as a stomp servers, instead of stomp clients described above. Connecting ending points of a stomp server with akka stream would allow creation of stomp servers really quick and easy. The protocol, doesn't define a lot of behavior for stomp servers, and thus, being able to create them quickly ad-hoc for you own particular need could be an asset. However, it seems more common the use case of stomp client as Source and Sink, and that is why I propose to start with the StompClient{Source,Sink}. @patriknw tried to create this kind of thing for actos, 5 years ago in https://github.com/patriknw/akka-stomp-server. With the low level of protocol already implemented in vertx-stomp, we could finish this pretty quickly.

Thoughts?