Skip to content

Introduction

The Dropbox adapter provides an integration between Neuron ESB and the Dropbox service for storing files to or reading files from Dropbox’s storage service.

Supported Modes

The Dropbox adapter only supports the SolicitResponse mode. In those mode, request messages will be sent to the Dropbox adapter and the adapter will respond with a reply.

Properties

article-adapter-d1

The Dropbox adapter exposes several properties that affect its runtime behavior:

  • Timeout: the timeout interval for Dropbox operations to complete. The default is 1 minute. An error will be returned and the message will be failed if Dropbox does not respond within this time period.
  • Access Token: the default OAuth 2 access token for the account to read or write files. This property can be used when the Dropbox is associated with a single application account and will not write to multiple accounts. This property is optional.
  • Maximum Block Size: when uploading a file to Dropbox, this property is the maximum number of bytes to transfer in each block. Files that are greater than this block size will be uploaded in chunks.

Messages

The Dropbox adapter is a request/reply adapter. Request messages are sent to Dropbox and reply messages are published back to the Neuron ESB topic.

Request messages are used to invoke an action from the Dropbox adapter. The Dropbox adapter makes use of the Action header on the message to determine which operation to invoke. The following Action header values are supported:

  • Upload
  • Download
  • Delete
  • Copy
  • Move
  • CreateFolder

Upload Action

The Upload action will upload the body of the message to a Dropbox folder as a file. The binary contents of the message will be uploaded, so the message can be text or a binary object such as an image.

The following custom properties are used to control uploading the file to Dropbox:

  • path: The path of the uploaded file in the Dropbox account. The path must begin with a forward slash (/). If this property is not specified, a file is created using the message’s identifier as the filename.

The reply message is the response from the Dropbox web service. For more information, see https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish.

Download Action

The Download action will download a file from Dropbox and will publish the file contents to a Neuron ESB topic. The body of the request message should contain the name of the file to download from Dropbox. Files should be prefixed with a forward slash (/my-file.txt).

The reply message from the Download action will be the contents of the file that was downloaded from Dropbox. The following custom properties will be set on the reply message providing details of the file that was downloaded:

  • id
  • rev
  • name
  • parentSharedFolderId
  • pathDisplay
  • pathLower
  • clientModified
  • serverModified
  • size

For information on these properties, please see https://www.dropbox.com/developers/documentation/http/documentation#files-download.

Delete Action

The Delete action will delete a file from a Dropbox folder. The body of the request message should contain the name of the file to delete. Files should be prefixed with a forward slash (/my-file.txt).

The reply message is the response from the Dropbox web service. For more information, see https://www.dropbox.com/developers/documentation/http/documentation#files-delete.

Copy Action

The Copy action will create a duplicate of a source file in a different location and under a different name. The body of the request message is ignored, but the following custom properties must be set:

  • from: The path of the source file to copy. Files must be prefixed by a forward slash.
  • to: The path where the file’s contents should be copied to. Files must be prefixed by a forward slash.

The reply message is the response from the Dropbox web service. For more information, see https://www.dropbox.com/developers/documentation/http/documentation#files-copy.

Move Action

The Move action will rename or relocate a file within a Dropbox account. The body of the request message is ignored, but the following custom properties must be set:

  • from: The path of the file to move or rename. Files must be prefixed by a forward slash.
  • to: The new path of the file. Files must be prefixed by a forward slash.

The reply message is the response from the Dropbox web service. For more information, see https://www.dropbox.com/developers/documentation/http/documentation#files-move.

CreateFolder Action

The CreateFolder action will create a new folder in a Dropbox account. The body of the request message should contain the path of the new folder to create. The path must be prefixed with a forward slash. The reply message is the response from the Dropbox web service. For more information, see https://www.dropbox.com/developers/documentation/http/documentation#files-create_folder.

Use Cases

Upload Books/Music/Videos to Subscriber Dropbox Folders

A media publisher publishing books, music, video, or other media can use the Dropbox adapter to deliver content to their subscribers. By publishing the content or a reference to the content to a Neuron ESB topic, the Neuron ESB solution can determine which users should receive the media, and can use the Dropbox adapter to deliver the media content to the user’s Dropbox folder.

Offline Storage

A Neuron ESB solution can use the Dropbox adapter to archive messages for backup purposes. The Dropbox adapter can subscribe to a topic or be used within a process or workflow to save the contents of the message to Dropbox for later use.

File Processing

A Neuron ESB solution can use the Dropbox adapter as the source for data to be delivered to and processed by the solution. The Neuron ESB solution can create a REST client connector to receive webhook notifications from Dropbox when files are added to a specific folder in the application’s Dropbox account. The Neuron ESB solution can then use the Dropbox adapter to download the file for processing.

Metadata

Messages sent to the Dropbox adapter can set the dropbox.accessToken property to control which account operations are performed on. By default, the configured Access Token property will be used if the dropbox.accessToken is not specified.

The dropbox.accessToken property is used when you integrate with Dropbox to upload files to or download files from the Dropbox accounts of your users. If your users give your application permission to access their Dropbox account, you can specify the user’s access token in the dropbox.accessToken property to upload a file to the user’s Dropbox account or download files from the user’s Dropbox account.