掲示板

6.1.0 - MessageBus: shared destination between different plugins

thumbnail
9年前 に Marco Rosetti によって更新されました。

6.1.0 - MessageBus: shared destination between different plugins

Junior Member 投稿: 68 参加年月日: 13/03/06 最新の投稿
I'm facing a comunication problem using message bus between two different plugin (portlet). Here's the situation
- Plugin A defines a listener on destination named "myQueue"
- Plugin B defines destination named "myQueue"

The problem is at tomcat startup: even if A depends on B, spring's beans for A are initialized before B's (A is deployed before B due to alphabetic order) and I get a "liferay Destination myQueue is not configured" error. This breaks comunication

I can't change plugin name so my workaround is to use an already defined destination (liferay/async_service defined in messaging-misc-spring.xml) but this is not a clean solution.

Liferay version: 6.1.0

How can I manage this problem?

Thanks in advance,

Marco
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Don't use Liferay's spring beans to instantiate the connection. Create your own beans to lazily create the listener at some later point.
thumbnail
9年前 に Marco Rosetti によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Junior Member 投稿: 68 参加年月日: 13/03/06 最新の投稿
Thanks for the response.

I resolved adding
MessageBusUtil.registerMessageListener("myQueue", new MyListener());
into startup action configured in application.startup.events portal.properties

and it works like a charm emoticon

Hope it helps
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
Great!
9年前 に sravan kumar によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Junior Member 投稿: 78 参加年月日: 13/02/19 最新の投稿
Hi,
you can use

required-deployment-contexts =<portlet-B> in portlet A
thumbnail
9年前 に Marco Rosetti によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Junior Member 投稿: 68 参加年月日: 13/03/06 最新の投稿
sravan kumar:
Hi,
you can use

required-deployment-contexts =<portlet-B> in portlet A


This does not work in my case because spring beans configured in (messaging-spring).xml are handled before checking for required contexts. Don't know if it's a bug or the correct behaviour
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: 6.1.0 - MessageBus: shared destination between different plugins

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
It is correct behavior. Portlet A (the portlet class) will not initialize until portlet B is done, but spring initializes and constructs beans when the app is loaded, not when the portlet is initialized.