{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
architects,cloud,enterprise-integration,database,integration,tips and tricks

Exploring the CloudHub Service for Application Data Storage

This CloudHub service arrived in the CloudHub R20 release, harnessing Mule’s Object Store capabilities.  Each 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 module. Are there are things you would want to use this for? Let us know in the comments!

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

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

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks