bedlaj / camel-nio2

This is now part of Apache Camel and this repository is archive only.

Home Page:https://camel.apache.org/components/latest/file-watch-component.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is archived version, which will not be updated. This functionality is now part of Apache Camel as file-watch component


Camel NIO.2 component

Description

This component uses Java-7 NIO.2 to watch directory changes. Please see WatchService JavaDoc, specially section "Platform dependencies" Before using this component.

Component dependency

Maven instructions:

Add JitPack.io repository

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>

Add dependency to component. Always use the same component version as is your camel-core version.

<dependency>
    <groupId>com.github.bedlaj</groupId>
    <artifactId>camel-nio2</artifactId>
    <version>2.22.2</version>
</dependency>

URI format

nio2:path[?autoCreate=false][&events=ENTRY_CREATE,ENTRY_MODIFY,ENTRY_DELETE]

Endpoint options

Name Default value Description
autocreate true Auto create directory if does not exists
events ENTRY_CREATE,ENTRY_MODIFY,ENTRY_DELETE Coma separated list of events to watch. Allowed values are: ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE

Examples:

from("nio2:/tmp/inputPath?events=ENTRY_CREATE,ENTRY_DELETE")
    .process(exchange -> {
        FileEvent event = exchange.getIn().getBody(FileEvent.class);
        log.info(event.getEventType()+" happened with path "+event.getEventPath());
    });

Other examples can be found in JUnit tests

About

This is now part of Apache Camel and this repository is archive only.

https://camel.apache.org/components/latest/file-watch-component.html

License:Apache License 2.0


Languages

Language:Java 100.0%