How to start immediate = false component?


I have following component:

    label = "Service name",
    description = "Service description",
    metatype = true,
    immediate = false)
            label = "My Label"
            name = "property-name",
            value = "my value",
            propertyPrivate = true
public class SampleServiceImpl implements SampleService {
    private final Logger log = 

     * OSGi Properties *
    private static final String DEFAULT_SAMPLE = "hello!";
    private String mySample = DEFAULT_SAMPLE;
    @Property(label = "Prop name", 
              description = "Prop description", 
              value = DEFAULT_SAMPLE)
    public static final String PROP_SAMPLE = "sample";


    protected void activate(final Map<String, String> config) { 
        mySample = PropertiesUtil.toString(config.get(PROP_SAMPLE), DEFAULT_SAMPLE);

    protected void deactivate(final Map<String, String> config) { }

It registered after cq started. It is expected behaviour.

How to start it ? I cannot find this interface.

@Component( enabled= false,...)

and go to system/console/components

Yes, this is expected behaviour for non-immediate components. From a blog post by Felix Meschberger on,

The OSGi Declarative services specification defines three types of components:

  • Immediate Components are immediately created when the providing bundle is started and may or may not provide services

  • Delayed Components provide services but are only created when used by a service consumer.

  • Factory Components are created on demand by calling the ComponentFactory.newInstance(Dictionary) method of the Component Factory service registered for the component.

So, if you set immediate = false, you will have a delayed component, which is activated on-demand by the run-time — you do not need to explicitly start the component yourself.

The main thing that you should be checking for is that the component is in a state of "Enabled" or "Registered" (as you mentioned that it is) rather than "Unsatisfied" (where it can't find references to dependencies it needs).

From the Felix documentation


The Component has successfully been activated but is a Delayed or Service Factory Component pending instantiation on first use (value is 32).

This video can help you solving your question :)
By: admin