Développer ma barre des réalisations de la Communauté.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

Cette conversation a été verrouillée en raison de son inactivité. Veuillez créer une nouvelle publication.

RÉSOLU

stop custom component permanently

Avatar

Level 6

Hi All,

We are using a custom compoment and need to stop permanently.We have clicked on stop button in component and went to inactive mode. If we restart the instance, all the components are loading and even this also moving to active state.

 

We need to stop and it should not get active even the instance restarted. Please advice.

1 solution acceptée

Avatar

Réponse correcte par
Employee Advisor

The state of the component is not persisted, so you would need to stop after the bundle has been started. I would recommend you to change your component and have either a "enabled" config option or just start it only if a configuration is present.

If you need a quick and dirty workaround to this problem, I would recommend to use the component disabler of ACS commons [1].

regards,
Jörg

 

[1] http://adobe-consulting-services.github.io/acs-aem-commons/features/osgi-disabler.html

Voir la solution dans l'envoi d'origine

4 Replies

Avatar

Level 2

Hello,

You can add OSGI Property "enabled" to the component.

Also create activation method:

@Activate @Modified protected void activate(ComponentContext componentContext) { if (enabled) { // your configurable property componentContext.disableComponent("COMPONENT_NAME"); } }


 

Avatar

Level 2

Hello,

1. You can create OSGI config file for your component.

<?xml version="1.0" encoding="UTF-8"?><jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"          jcr:primaryType="sling:OsgiConfig"          enabled="{Boolean}false"/>

2. Add property "enabled" to the component.

Also create activation method:

@Activate @Modified protected void activate(ComponentContext componentContext) { if (enabled) { // your configurable property componentContext.disableComponent("COMPONENT_NAME"); } }
 

Avatar

Réponse correcte par
Employee Advisor

The state of the component is not persisted, so you would need to stop after the bundle has been started. I would recommend you to change your component and have either a "enabled" config option or just start it only if a configuration is present.

If you need a quick and dirty workaround to this problem, I would recommend to use the component disabler of ACS commons [1].

regards,
Jörg

 

[1] http://adobe-consulting-services.github.io/acs-aem-commons/features/osgi-disabler.html

Avatar

Employee

Here an example without any coding needed...

http://aemfaq.blogspot.ro/2013/05/sample-runmode-based.html