2

I would like to change configuration of a File Source at runtime. From what I see in docs and in source definition, directory is statically defined (i.e. no expressions), see the bean definition.

I know that using plain Spring Integration it's possible to call setDirectory(...) on inbound file channel adapter. Is there any way to do same thing in XD?

Thanks in advance.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
execc
  • 1,083
  • 12
  • 25

1 Answers1

1

While you can call setDirectory() on the message source, beware that auto-create-directory (default true) won't work - the directory is created during bean creation. It will work for existing directories however.

One possibility to do what you want is to customize the file source to add a wrapper MBean that will delegate to the FileReadingMessageSource.setDirectory() You can get a reference to the bean using bean name <adapterId>.source (you would have to give the adapter an id attribute).

You could then change the directory over JMX (or by adding a control-bus to send a message to your wrapper - in which case you would need some other technology to get a message to the control bus - http, tcp, etc).

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • I was thinking about doing it without customizing source, now I see that it's ok, thanks. – execc Jan 15 '16 at 19:55