In this blog, I would explain how to create bridge between Lift Comet Actor and Akka Actor.
Since Lift has its own actor model, so a bridge is needed to fill communication gap between LiftComet and Akka Actor, so that Akka actor would be able send message to comet, once comet has been set.
This bridging concept would be more useful for those web applications, which are built in Lift and using Akka Actor for message passing and running in distributed environment.
I have created a small Lift Login application with Things to Do and Chat functionality. you can find full source code here on GitHub:
You will find bridge concept in Chat Module.
Here is one BridgeController
, which would provide a BridgeActor
on the request of Chat comet. Comet would get registered in forwarding target.
Akka actor would send message to this forwarding target.
Concept would be more clear from below lines:-
In Chat.scala:-
We need to instantiate bridge at the time of setting up comet. This would register comet in forwarding target of BridgeActor.
We also need to kill bridge actor at the time of shutting down Comet. We can do this by giving PoisonPill.
This is a working example and would be more useful for remote application.
Please provide your valuable feedback.