Foros de discusión

Use more AutoDeployListener services in Liferay 7

thumbnail
Gustav Novotný, modificado hace 6 años.

Use more AutoDeployListener services in Liferay 7

New Member Mensajes: 15 Fecha de incorporación: 25/01/12 Mensajes recientes
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, modificado hace 6 años.

RE: Use more AutoDeployListener services in Liferay 7

Liferay Legend Mensajes: 2047 Fecha de incorporación: 7/10/08 Mensajes recientes
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.