Bridging the Communication between Lift Comet Actor and Akka Actor in Scala

Table of contents
Reading Time: 2 minutes

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.

Written by 

Ayush is the Sr. Lead Consultant @ Knoldus Software LLP. In his 10 years of experience he has become a developer with proven experience in architecting and developing web applications. Ayush has a Masters in Computer Application from U.P. Technical University, Ayush is a strong-willed and self-motivated professional who takes deep care in adhering to quality norms within projects. He is capable of managing challenging projects with remarkable deadline sensitivity without compromising code quality.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading