You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Bengt Rodehav <be...@rodehav.com> on 2010/03/15 19:59:37 UTC

Uses managed-service-factory but get no callback on configuration changes

Hello everyone,

I'm trying to use Spring-DM's support for managed-service-factory. My
artifact (deployed in Karaf 1.4) contains the following XML snippet in
beans.xml:

<osgix:managed-service-factory id="test-container"
factory-pid="se.digia.connect.routes.test.container"
    update-strategy="bean-managed" update-method="configurationUpdate">
    <osgix:interfaces>
      <value>se.digia.connect.core.api.IService</value>
    </osgix:interfaces>
    <bean class="se.digia.connect.routes.test.container.impl.TestContainer"/>
  </osgix:managed-service-factory>

I then drop a configuration file called
"se.digia.connect.routes.test.container-first.cfg" in the etc folder.
This causes a service containing the correct configuration to be
started and registered. Via Felix WebConsole I can see the
configuration and it's the correct one. When I delete the
configuration file from the "etc" folder, the service is stopped. It
all works. However, my bean (an instance of
se.digia.connect.routes.test.container.impl.TestContainer) never gets
a callback. I expected the "configurationUpdate()" method of the
TestContainer class to be called whenever the configuration changes.
My callback method has the following signature:

  public void configurationUpdate(Map<String, ?> theProperties) throws Exception

When I use a "managed-properties" instead of "managed-service-factory"
I do get the callback. The following works perfectly:

  <bean id="testRoute" class="se.digia.connect.routes.test.impl.TestRoute">
    <osgix:managed-properties
persistent-id="se.digia.connect.routes.test"
update-strategy="bean-managed"
      update-method="configurationUpdate" />
  </bean>
  <spring-osgi:service ref="testRoute"
interface="se.digia.connect.core.api.IService"/>

What am I missing? How can I get a notification callback when the
configuration is changed when using a managed-service-factory?

Happy for any clues you may have.

By the way is this the recommended way to use managed service
factories? Are there any other (non Spring-DM) ways of doing this?
IPojo for example.

/Bengt

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org