agourlay / omnibus

An HTTP-friendly persistent message bus.
Apache License 2.0
70 stars 4 forks source link

Websocket #8

Closed agourlay closed 9 years ago

agourlay commented 10 years ago

Would be awesome to pub/sub via websocket. Wait for websocket to be implemented in akka-http

He-Pin commented 10 years ago

how about using Play with akka?

agourlay commented 10 years ago

As I am using spray, I have an eye on https://github.com/wandoulabs/spray-websocket.

He-Pin commented 10 years ago

yeah,by wandoujia China.in fact I want to do something just like what you have done.but seems you just keep the last state of the topic but I may want to keep all the message. what you have done will be nice to server something like weather service or something that.

agourlay commented 10 years ago

Actually I keep all messages within akka-persistence journal. I can then replay those messages when the client asks for it.

He-Pin commented 10 years ago

I have asked this question on akka-user,then said do not using akka-persistence as database,and here seems you are using it like this. for the replay,are you sending a Recover message to the EventProcessor?

I once want to replay and cache all the message in an actor's inner map,but finally seems not that good path.

there is noway to read the message from the journal right,for now.

He-Pin commented 10 years ago

BTW,could you please show me the line when you replay the message when the client ask for it?thanks.

agourlay commented 10 years ago

I am not using akka-persistence as a classical database, so this is not a problem. My current concern is that I am using akka-persistence to implement a durable queue which is not recommended by the author itself.

https://groups.google.com/forum/#!searchin/akka-user/queue/akka-user/5fRv72GFE4E/54TFEttucX8J

I am still trying to find another design to implement durable queues properly.

Omnibus is still a side project that I did for learning purpose, so please don't take my design for granted.

When a client ask to replay a segments of message (from-> to), I just instantiate a view that will replay events. I just filter the one that interest the client and forward them.

https://github.com/agourlay/omnibus/blob/master/src/main/scala/omnibus/domain/subscriber/Subscription.scala

Once again this is far from being optimal. Hope it helps you.

He-Pin commented 10 years ago

when I was making push and for now ,I am using redis for the durable queue,and akka persistence for the event replay,just state no message.

yeah ,just as what you said,that not recommended and seems like the Persistence Channel and View are removing too.

agourlay commented 10 years ago

Thanks for the information.

I do not know the latest decisions in terms of deprecation but that is the risk when using experimental APIs ;)

He-Pin commented 10 years ago

https://github.com/akka/akka/issues/15230 https://github.com/akka/akka/issues/15231

yes ,the risk.

agourlay commented 10 years ago

Nice pointers. It looks like the durable message queue will eventually come back, good for Omnibus.

He-Pin commented 10 years ago

so could you show me where your code line,replay the message?I am not clear with your code now~:P thanks

agourlay commented 10 years ago

I already gave you the link above. https://github.com/agourlay/omnibus/blob/master/src/main/scala/omnibus/domain/subscriber/Subscription.scala#L15

This class is an akka-persistence View for a topic processor. That means it will replay automatically the message from the processor when created. Then I just filter them and forward them to the actor who is interested in those, in my case the parent.

He-Pin commented 10 years ago

thanks ,I was Enlightened.

He-Pin commented 10 years ago

so how about the replay speed?

agourlay commented 10 years ago

I did not benchmark this part.

He-Pin commented 10 years ago

I just change my application level pull to to using the view. thanks for you code. I think the view could be used as a fetcher ,to fetcher the data,and then publish message to the eventstream. I think you project could use this too.

SubchannelClassification
agourlay commented 10 years ago

Thx, I will have a look at this.

He-Pin commented 10 years ago

I am using akka and cluster persistence to implement an push server,Hard to make every message delivered,I have switch from the redis way to the EeventProcessor - View way.This may make my life a litter easier.