掲示板

MessageBus overwrites config of messaging-spring.xml

9年前 に Joerg Schaefer によって更新されました。

MessageBus overwrites config of messaging-spring.xml

New Member 投稿: 12 参加年月日: 14/10/21 最新の投稿
Hi,

i am using Liferay 6.2 EE and i tried to implement two plugins. Each plugin sends and listens to the same destination!
I did the configuration as described in Using Message Bus with the messaging-spring.xml in both plugins.
But after deploying the plugins just one listener works. It is the listener wich is lastly deployed or loaded by the Liferay framework.
Sending works fine for both plugins.

I think, the framework overwrites or creates the destination and assigned listeners if it gets a messaging-spring.xml.
I would expect that the framework just add a new Listener to a destination if it is available.

Here you can find one of my messaging-spring.xml. The second plugin uses just another listener. (<ref bean="messageListener.msg_listener2" />)

<bean id="messageListener.msg_listener1" class="com.sample.portlet.messaging.MsgListener1" />

    <bean id="destination.testupdate" class="com.liferay.portal.kernel.messaging.ParallelDestination">
        <property name="name" value="msgTest/testupdate" />
    </bean>

    <bean id="messagingConfigurator" class="com.liferay.portal.kernel.messaging.config.PluginMessagingConfigurator">
        <property name="messageListeners">
            <map key-type="java.lang.String" value-type="java.util.List">
                <entry key="msgTest/testupdate">
                    <list value-type="com.liferay.portal.kernel.messaging.MessageListener">
                        <ref bean="messageListener.msg_listener1" />
                    </list>
                </entry>
            </map>
        </property>
        <property name="destinations">
            <list>
                <ref bean="destination.testupdate" />
            </list>
        </property>
    </bean>


Has anybody an idea? thx.
thumbnail
9年前 に David H Nebinger によって更新されました。

RE: MessageBus overwrites config of messaging-spring.xml

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
Both listeners work, but only one is receiving the messages.

The LMB is not a load balancing system or anything like that, it's not a pub/sub mechanism where all subscribers will receive a message. It's simply "give a message to a particular destination to a listener", period. Multiple listeners are not supported.

If you need something like this, you should use separate destinations and each portlet listen to their own destination, and when publishing messages write them to all destinations.
thumbnail
9年前 に Dániel Jávorszky によって更新されました。

RE: MessageBus overwrites config of messaging-spring.xml

New Member 投稿: 4 参加年月日: 12/03/09 最新の投稿
Hi Joerg,

This is doable, however, it needs a slight change in your messaging-spring.xml file. The reason it's not working currently is because the destination is specified by both of your plugins.

In order for both plugins to receive the messages, you'll have to remove the destination from one of them - or if you have more than two, the destination should be added by only one of the plugins.

Once you made the change, redeploy both of your plugins and test to see if it's working.

Best,
Daniel