Skip to content

FTP Consumer Events

The consumer components p6ftd and p6sftp produce events as user(s) make changes to their virtual file systems.

User FTP events can be used to trigger p6 services to process the consequences of those events. Alternatively the inbuilt file component can be used to ‘listen’ to the file system used to represent a users FTP virtual file system.


The latter has traditionally been the approach taken with b2box5

The Exchange generated by the ftp consumer components has the following headers

  • user (The id of the current user)
  • path (The absolute path of teh file/folder in the file system)
  • pathFrom (Only available when action = FILE_MOVED)
  • action ( The FTP action )

FTP Actions



If the file component is the preferred choice for monitoring file system changes the events generated by the ftp consumer can simply be logged:

    .description('FTP Listener')

Filtering Events

Not all FTP events may be of interest to a p6 service so the event types can be filtered after they are emitted by the consumer:

    .description('SFTP Listener')
    .filter { request ->
        def action = request.getIn().getHeader('action', String.class)
        if( action == "FILE_WRITTEN" || action == "FILE_MOVED" ) true
        else false


Here we use Groovy in a filter expression returning ‘true’ when the event should be forwarded.

In addition to filtering, message aggregation is a powerful tool to batch FTP consumer events.

See: Camel Aggregation & Strategies