java - Detect file changes in Spring Integration -
use case: want listen file directory, , every time makes change on file, want start process.
this configuration far:
<int-file:inbound-channel-adapter directory="${dir}" auto-startup="${auto.startup}" prevent-duplicates="true" filter="inputfilefilter" channel=ruleschannel"> <int:poller fixed-delay="${delay}" /> </int-file:inbound-channel-adapter>
where inputfilefilteris custom bean , ruleschannel processing later.
the inputfilefilter takes array of files , returns list of files, sorted on file ending. seems pulling endlessly, , "prevent-duplicates"-check done after filter (i.e. file added, seems it's not sent ruleschannel).
anyway, problem need whole thing pick file changes, not new files. mainly, it's configuration file being changed every , then, , need update keep in sync.
yes, horrible solution over, it's not call, , seems have no choice.
any ideas?
edit: i've played bit around http://docs.spring.io/spring-integration/reference/html/files.html#_watchservicedirectoryscanner see if perhaps copy class , use standardwatcheventkinds.entry_modify doesnt seem help.
basically, if had way "start thread , keep running", fine well.
what had implement own defaultdirectoryscanner.
it registers watcher @ startup, , checks watcher when receives request inbound-channel-adapter through listeligibleitems(..)
to able handle 2 separate file directories, added 2 different watchers , 2 different file pollers. ensure readability in code , avoid hacking way around "directory"-part of inbound-channel-adapter.
Comments
Post a Comment