Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Book Image

Liferay 6.x Portal Enterprise Intranets Cookbook

Overview of this book

Table of Contents (19 chapters)
Liferay 6.x Portal Enterprise Intranets Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using Liferay Service Bus for communication between portlets


The message bus is a mechanism for sending messages to different components in Liferay. This approach is very common, because it prevents class-loading issues. It is very important, because Liferay is a portlet container, and each portlet doesn't have information about the others. For that reason, Liferay provides a message bus that allows communication between portlets. An application that sends an event/message is called a producer, and an application that receives messages is called a consumer.

The message bus architecture supports asynchronous and synchronous messaging. Synchronous messages wait for a response, and asynchronous messages send a message, forget it, or receive a callback. The main difference between synchronous and asynchronous messages is the fact that the first one block threads and wait for the response.

In this recipe, we will show you how to use a message bus in a real example. Let's assume that our goal is...