Hi,

it's not on ServiceMix but on Spring property placeholder. The property placeholder resolves data at startup (bean creation) and stores it in cache. So, properties are loaded at startup only. In your case, you can add a kind of flush method on your property placeholder that you call on demand. Or you can define a singleton with a cache invalidation timeout to flush periodically the cache (as you made using the timer).

It's exactly the same thing concerning ServiceMix components xbean: if you change a property in the xbean.xml, you need to reload the component endpoint (stop/start). You can do it using JMX layer.

Regards
JB

subh wrote:
Thanks for the pointer.

I added a DBPlaceholderConfigurer and change my filepoller configurations as
below

<file:poller service="dynatest:filePollerSvc"
               endpoint="endpointFP"
               targetService="dynatest:fileSenderSvc">
<property name="marshaler">
                 <bean
class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
              </property>
              <property name="file" value="#{filepolling.incoming.dir}">
</property> </file:poller>
  <bean id="propertyConfigurer"
class="com.dynatest.util.DBPlaceholderConfigurer">
        <property name="dataSource" ref="dataSource"/>
  </bean>

  <bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/DynaTest"/>
        <property name="username" value="root"/>
        <property name="password" value="root"/>
  </bean>

I even added timer to execute queries at regular intervals to set the
properties from DB

<bean id="timer"
class="org.springframework.scheduling.timer.TimerFactoryBean">
    <property name="scheduledTimerTasks">
      <bean id="reloadProperties"
class="org.springframework.scheduling.timer.ScheduledTimerTask">
                <property name="period" value="15000"/>
                <property name="runnable">
                  <bean class="com.dynatest.util.ReloadConfigurationsFromDB">
                    <property name="reconfigurableBeans">
                                <ref bean="propertyConfigurer"/>
                    </property>
                  </bean>
                </property>
      </bean>
    </property>
  </bean>

The queries are getting executed, and new properties are getting read and
set whenever i update the table configuration values, but Servicemix doesn't
seem to load the new properties and keeps on polling the original file
directory. Is there some kind of caching being done in Servicemix side..how
can I override that?

regards
Subh


Jean-Baptiste Onofré wrote:
Hi Subh,

You can define several File/FTP poller endpoint and inject use a spring PropertyPlaceHolder. You can extend the standard PropertyPlaceHolder to use a database backend.

Regards
JB

subh wrote:
I have a requirement to poll different ftp servers with different file
paths
which changes/updates continuously. I am thinking of writing a generic
File/FTP poller and using the file path, ftp server properties etc. from
the
DB.
Is there a way I can have these properties injected into my respective
servicemix-file and ftp components from DB or do I need to write a custom
servicemix bean?

If I write a servicemix-bean, how can I manipulate the polling schedule
of
these components?

-regards, subh


Reply via email to