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:
- Persisting OAuth tokens – all our OAuth enabled connectors can store tokens and restore them using ObjectStores
- 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.
Another really common use case is storing synchronization state. For
example, let’s say that you only want to synchronize new invoices from
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"/> </poll> <!-- 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"/> </flow>
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.