You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Camel Dropbox component

Available as of Camel x.xx

The dropbox: component allows you to treat Dropbox remote folders as a producer or consumer of messages. Using the Dropbox Java Core API (reference version for this component is 1.7.x), this camel component has the following features:

  • As a consumer, download files and search files by queries
  • As a producer, download files, move files between remote directories, delete files/dir, upload files and search files by queries

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-dropbox</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

dropbox://[operation]?[options]

Where operation is the specific action (typically is a CRUD action) to perform on Dropbox remote folder.

Operation 

Unknown macro: {div}

Operation

Description

del

deletes files or directories on Dropbox

get

download files from Dropbox

move

move files from folders on Dropbox

put

upload files on Dropbox

search

search files on Dropbox based on string queries

Operations require additional options to work, some are mandatory for the specific operation.

Options

In order to work with Dropbox API you need to obtain an accessToken and a clientIdentifier
You can refer to the Dropbox documentation that expalins how to get them  

Below are listed the mandatory options for all operations:

 

Unknown macro: {div}

Property

Mandatory

Description

accessToken

true

The access token to make API requests for a specific Dropbox user

clientIdentifier

true

Name of the app registered to make API requests

Headers

The following headers are set on exchanges during message transport.

Unknown macro: {div}

Property

Value

CouchDbDatabase

the database the message came from

CouchDbSeq

the couchdb changeset sequence number of the update / delete message

CouchDbId

the couchdb document id

CouchDbRev

the couchdb document revision

CouchDbMethod

the method (delete / update)

Headers are set by the consumer once the message is received. The producer will also set the headers for downstream processors once the insert/update has taken place. Any headers set prior to the producer are ignored. That means for example, if you set CouchDbId as a header, it will not be used as the id for insertion, the id of the document will still be used.

Message Body

The component will use the message body as the document to be inserted. If the body is an instance of String, then it will be marshalled into a GSON object before insert. This means that the string must be valid JSON or the insert / update will fail. If the body is an instance of a com.google.gson.JsonElement then it will be inserted as is. Otherwise the producer will throw an exception of unsupported body type.

Samples

For example if you wish to consume all inserts, updates and deletes from a CouchDB instance running locally, on port 9999 then you could use the following:

from("couchdb:http://localhost:9999").process(someProcessor);

If you were only interested in deletes, then you could use the following

from("couchdb:http://localhost:9999?updates=false").process(someProcessor);

If you wanted to insert a message as a document, then the body of the exchange is used

from("someProducingEndpoint").process(someProcessor).to("couchdb:http://localhost:9999")
  • No labels