App Connect

 View Only

Using IBM® App Connect to interact with Couchbase

By Shahmini Arumugam posted Sat October 29, 2022 11:52 AM

  

Co-author – Srihari Ananda Kumar 

Couchbase is a distributed NoSQL cloud database for interactive applications. It features reliable performance, easy scaling, and a flexible data model.

Building a flow in IBM App Connect with Couchbase

 Use App Connect to build flows that integrate with Couchbase and other applications. The connector is displayed as Couchbase on the App Connect User Interface (UI).

To allow App Connect to connect to your Couchbase account, you need to fill in the connection fields that you see in the App Connect Designer Catalog page or flow editor. For more information on connection fields, see How to use IBM App Connect with Couchbase.

 

Couchbase objects

The following are Couchbase action objects that can be run in App Connect.

Objects

Description

Buckets

A bucket is used for storing data in Couchbase Server.

Collections

A collection is a data container that is defined on Couchbase Server within a bucket.

Custom SQL

A customized SQL statement that can include complex queries.

 Documents

A document refers to an entry in the database.

 Scopes

A scope is a mechanism for the grouping of multiple collections


Scenario
1: Sync employee records between Couchbase and Amazon DynamoDB

Consider this scenario where you can sync employee records between Couchbase and Amazon DynamoDB. In this example, the flow retrieves employee records from Couchbase and synchronizes that data with Amazon DynamoDB. A Slack message is then sent to the intended channel. 

 

In this flow:

  1. You run a scheduler-based flow that retrieves documents containing the employee records in Couchbase.
  2. With the Retrieve documents operation, the employee records from Couchbase are retrieved based on a condition where the employee’s joining date is greater than or equal to the previous event time, which is the date the flow was last executed.

    For example:

    Let's say the scheduler is set to run the flow monthly, and the flow was last executed on August 31st. The records of the employees who joined on August 31st up to the current date (assuming today's date is September 21st) will be retrieved.

  3. For each retrieved employee record, it checks whether the employee record exists in Amazon DynamoDB.
  4. If the employee record already exists, the Amazon DynamoDB Upsert and Create item operation updates the employee details (if there are any changes to the current record) in the specified Amazon DynamoDB table based on the employee ID.
  5. If the employee record doesn’t exist, then the employee record is inserted into the specified Amazon DynamoDB table based on the employee ID through the Amazon DynamoDB Upsert and Create item. The record is added with the employee’s details.
  6. A Slack message gets sent to the intended channel to notify the employee’s record has been updated.

    Important:

    You must create an index for each collection created in the Couchbase endpoint application. If you fail to do so, an error exception is thrown and you won't be able to perform the retrieve operation on the collection.

    You can refer to the Couchbase documentation for more information on creating an index:

Scenario 2: Create a document in Couchbase whenever a ticket gets created in Zendesk Service  

Consider this scenario; when a ticket is created in Zendesk Service, a document is created in Couchbase with the specified document data. A Slack message is then sent to the intended channel.


In this flow:

  1. The event-driven flow is triggered whenever a new ticket gets created in Zendesk Service.
  2. With the Create document operation, a document is created in the Couchbase collection based on the Zendesk Service ticket ID. The document is mapped to the relevant Zendesk Service properties, which will be added to the Couchbase document.
    For example:
  3. A Slack message gets sent to the intended channel to notify that a document has been created based on the Zendesk Service ticket ID.
    For example:

Note: The schema of the Create interaction is dynamically and automatically discovered from an existing set of records for mapping.



Resources

Try out our templates

You can view the following use cases in the Templates gallery in your App Connect Designer instance.

  • Sync employee records between Couchbase and Amazon DynamoDB
    Template URL: https://<your-instance-id>/templates/Sync%20employee%20records%20between%20Couchbase%20and%20Amazon%20DynamoDB

  • Create a document in Couchbase whenever a ticket gets created in Zendesk Service
    Template URL: https://<your-instance-id>/templates/Create%20a%20document%20in%20Couchbase%20whenever%20a%20ticket%20gets%20created%20in%20Zendesk%20Service

You must enable the Designer AI features in your containerized environment in order to access the App Connect templates. For more information, see The preloaded IBM App Connect templates.

You can also import these use cases directly into your App Connect Designer. These templates are added to a public GitHub repository at https://github.com/ot4i/app-connect-templates/tree/cp4i-templates/resources.

0 comments
102 views

Permalink