Over a million developers have joined DZone.

Exploring the CloudHub Service for Application Data Storage

DZone's Guide to

Exploring the CloudHub Service for Application Data Storage

· Integration Zone ·
Free Resource

How to Transform Your Business in the Digital Age: Learn how organizations are re-architecting their integration strategy with data-driven app integration for true digital transformation.

This CloudHub platform service arrived in the CloudHub R20 release, harnessing Mule’s Object Store capabilities.  Each CloudHub integration application is given it’s own storage, with zero configuration required. This makes it a extremely easy to implement two very important integration scenarios:

  1. Persisting OAuth tokens – all our OAuth enabled connectors can store tokens and restore them using ObjectStores
  2. Storing synchronization state – your application may need to keep track of the last record synchronized, so the next time it synchronizes it can resume where it left off

In addition, you can store any other data you want in it as well! Let’s take a more in depth look at these scenarios.

Persisting OAuth tokens

For those using any of our connectors which support OAuth, the first question is always how to save and restore OAuth tokens across the application lifecycle. Now it’s simply a matter of using the Object Store module as documented in each connector. Even better, we’re making it in Mule 3.3.1 so that OAuth token management will work out of the box with no extra configuration.

Storing synchronization state

Another really common use case is storing synchronization state. For example, let’s say that you only want to synchronize new invoices from your CRM into your billing system. You could keep track of the last invoice synchronized and use it in your search query when syncing invoices.

Here’s a quick pseudo sample:

<objectstore:config name="Objectstore" partition="default" doc:name="Objectstore"/>

<flow name="PollForNewInvoices">
    <poll frequency="10000">
        <!-- Get the last invoice synced -->
        <objectstore:retrieve config-ref="Objectstore" key="lastInvoiceId" defaultValue-ref="#[-1]" doc:name="Get Last Invoice ID"/>
    <!-- search for invoices with an ID greater than lastInvoiceId -->
    <flow-ref name="GetUpdatedInvoices"/>
    <!-- Update the last invoice synced -->
    <objectstore:store config-ref="Objectstore" key="lastInvoiceId" value-ref="#[payload[payload.size() - 1].id]" overwrite="true" doc:name="Objectstore"/>

his way even if you update your integration , it’ll resume where it left off.

Viewing your Application Data

Once you’ve got data inside your object store, you can easily view it by clicking on the Application Data tab when managing your CloudHub application. From here you’ll be able to view and search your data. We’re also adding the ability to edit and delete data in the future.

And more?

You can use ObjectStores to store any data that you want (within limits) using the ObjectStore module. Are there are things you would want to use this for? Let us know in the comments!

Build and deploy API integrations 7x faster. Try the Cloud Elements 100% RESTful platform for 30 days free. Access your trial here.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}