Foren

Use more AutoDeployListener services in Liferay 7

thumbnail
Gustav Novotný, geändert vor 6 Jahren.

Use more AutoDeployListener services in Liferay 7

New Member Beiträge: 15 Beitrittsdatum: 25.01.12 Neueste Beiträge
Hi,
I'm now migrating a 6.2 project to DXP that has several plugins, each was using own AutoDeployListener hook processing specific file (according to file name).
Now I'm migrating those plugins to OSGi modules, but I'm facing the problem that only one AutoDeployListener service component is active and processing files. It seems according to what is in
com.liferay.portal.kernel.deploy.auto.AutoDeployDir.deploy(AutoDeploymentContext autoDeploymentContext, List<autodeploylistener> autoDeployListeners)</autodeploylistener>

method, only one service is chosen serviceTracker and used. (If I deploy two AutoDeployListener components to portal, only that with higher service.ranking is used.)

Do you se any way how to use more custom AutoDeployListeners processing different files via auto deploy mechanism?

Thank you for you hints!

Gustav
thumbnail
Amos Fong, geändert vor 6 Jahren.

RE: Use more AutoDeployListener services in Liferay 7

Liferay Legend Beiträge: 2047 Beitrittsdatum: 07.10.08 Neueste Beiträge
I think it's due to this in AutoDeployDir.java. It looks like it only getting a single service back from the serviceTracker.

I'm not sure why it's not pulling all the services. If you have a chance, try changing it to _serviceTracker.getServices() and if that works, contribute the code.

public static void deploy(
			AutoDeploymentContext autoDeploymentContext,
			List<autodeploylistener> autoDeployListeners)
		throws AutoDeployException {

		AutoDeployListener autoDeployListener = _serviceTracker.getService();

		if (autoDeployListener != null) {
			if (autoDeployListener.isDeployable(autoDeploymentContext)) {
				autoDeployListener.deploy(autoDeploymentContext);</autodeploylistener>


If that's not possible to do, I guess you can create one "router" deploy listener that will route the file to the proper one.