stop custom component permanently | Community
Skip to main content
Level 6
October 16, 2015
Solved

stop custom component permanently

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Employee
October 16, 2015

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

4 replies

Illia_Kononov
Level 2
October 16, 2015

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"); } }


 

Translate
Illia_Kononov
Level 2
October 16, 2015

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"); } }
 
Translate
joerghoh
joerghohAccepted solution
Employee
October 16, 2015

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

Translate
Feike_Visser1
Employee
October 16, 2015

Here an example without any coding needed...

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

Translate