arrow_back

Build and Configure an Integration using Application Integration

Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

Build and Configure an Integration using Application Integration

Lab 1 hora 30 minutos universal_currency_alt 1 crédito show_chart Introdutório
Test and share your knowledge with our community!
done
Get access to over 700 hands-on labs, skill badges, and courses

GSP1253

Google Cloud self-paced labs logo

Overview

Application Integration is an Integration-Platform-as-a-Service (iPaaS) solution on Google Cloud that offers a comprehensive set of core integration tools to connect and manage the applicatons and data required to support various business operations.

This hands-on lab introduces you to the core concepts and functionalities of Application Integration. You will learn how to build an integration using recommended best practices. With Application Integration's out-of-the-box triggers, configurable tasks, and friendly user interface, you can create enterprise-level integrations with ease.

What you'll learn

In this lab you will learn how to do the following:

Part 1: Design and create an integration

  • Create an integration that subscribs to a Pub/Sub topic and connects to an inventory database
  • Update the inventory db based on the incoming message
  • Add a Trigger and use the Test feature verify the integration functionality
  • Debug integration invocations using Logs

Part 2: Add advanced features

  • Implement approval logic to resume integration workflow based on the order information
  • Conditionally call the corresponding provisioning system based on the product ordered

You will incrementally build out the below solution. There are a total of two parts to this lab, each focusing on different topics. Along the way, you will get hands-on experience creating connectors, data mapping, using conditional tasks, and more.

Application Integration Jam order fulfillment work flow

Note: Some services have been created for this lab: A Cloud MySQL database and two integrations.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

Learn more with Application Integration

While the lab is provisioning, take a look the Application Integration documentation, which explains the various fundamental concepts of Application Integration used throughout this lab.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left. Navigation menu icon

Open Application Integration

  1. Navigate to the Application Integration page by typing Application Integration into the search bar at the top of the page.
  2. Click the search result, Application Integration.

Application Integration in search result

  1. You will see the Application Integration console as below:

Application Integreation console

Lab Scenario

In this lab you manage an inventory database. As orders are placed, an Integration is triggered that updates the inventory database.

  • If the order size exceeds a certain threshold, it waits for user approval before resuming the integration.
  • If the order is under that threshold it auto-resumes to the next step of calling the corresponding provisioning system based on the product ordered.

Part 1: Design and create an Integration

Persona:  IPaaS Integration Developer

Use Case

You have a requirement to design and create an Integration flow that supports the business by using the Google Cloud Application Integration platform.

How can Application Integration help?

With Application Integration, business organizations can:

  • Configure and use integrations to connect enterprise applications like Salesforce, databases like MySQL, and event driven systems like Pub/Sub.
  • Create long-running processes triggered by a variety of source data inputs.
  • Invoke integrations in response to external events or on a customized schedule.
  • Access and transform data payloads between applications into meaningful schema.

Task 1. Create an integration

  1. From the Navigation menu, click on Application Integration and select Integrations. You will see a list of existing integrations.
  2. Click on CREATE INTEGRATION.

create integration button

  1. Fill in the details as below then click on CREATE.
  • Integration name: internet-order-entry
  • Description: Sub-Integration to save Internet Orders to the Database
  • Region: From the dropdown list select the Region (Please use the Lab Region from Lab Setup)

create internet order.png

  1. Now that the internet-order-entry is open, click on Triggers, then select API from the dropdown list and drag it to the designer console.

API selected from Triggers menu

You should see API Trigger added to your integration designer console.

API block added to designer console

Add a variable

  1. Now create a new variable by clicking the CREATE button in the variables window.

Create button selected to create a new variable

  1. Enter the information provided below to create the new variable.
  • Name: input
  • Variable Type: Input to Integration
  • Data Type: JSON
  • Select Infer from a sample JSON payload and add the value
{"order_id": 10000}

create variable form filled out

  1. Click Create.

Add a Task

  1. Click on Tasks and search for Connectors. Once found, click and drag the connectors task to the Integration designer console.

Connectors added to search field and found under Integration Services

  1. Place the Connectors block below the API Trigger block.

Connectors block added to Integration designer console

  1. On the Connectors panel change the Label name to Save Internet Order to DB. After updating the label click on Configure Connector.

Save Internet Order to DB label with Configure Connector button

  1. Select the region from the dropdown list (Use the Lab Region from Lab Setup) and then choose cloudsql-mysql from the Connection list. Click Next.
Note: The Cloud SQL connector for this lab has already been created for you.
  1. Under Type select Entities, and click Next.
  2. For Entity select internet_orders and for Operation select Create.
  3. Then click Next and Done.
Connector configuration details
  1. Click on Tasks and search for Data Mapping.

data mapping task.png

  1. Drag the Data Mapping block to the Integration designer console. Make sure you put it in between the API Trigger and the Database connector.

Data Mapping block between API Trigger and Save Interent Order to DB blocks

  1. On the Integration designer console, click on the Data Mapping task to open the mapping panel on the right.
  2. Change the Label name to Map Input and click the Open Data Mapping Editor button.

configuredatamapper.png

  1. In the Data Mapping Editor toggle the Variables panel. Once opened you will see a list of variables populated on the left.

toggle variables panel icon

  1. Select input and drag it to the Input section
  2. Select connectorInputPayload and drag it to the Output section.

input and output variables dragged into Input and Output sections of the Integration design console

  1. Close the Data Mapping Editor.

  2. Now you need to pull forks by clicking on the empty circles in each block. Connect the API Trigger to the Map Input, the Map Input to the Orders DB. Once completed click Publish.

publish internet.png

Note: You must publish the Integration before moving on to Test. The platform will ask you to publish before testing.

Test Integration

  1. Click on TEST and enter the sample JSON payload below as input:
{"order_id": 10000}

test order id.png

  1. click TEST INTEGRATION.

  2. Click on VIEW LOGS to check logs.

View Logs button selected

  1. Open the logs by clicking the dropdown next to internet-order-entry.
test order logs valid.png

Validate that the integration has succeeded.

You've successfully created and configured an Integration. In the next step you will view and modify existing integrations.

Click Check my progress to verify your performed tasks.

Create an integration

Task 2. View and modify an existing integration

You are able to leverage other created integrations in a holistic integration design. Next, you will modify an exiting integration.

  1. Go back to the left navigation menu and select Integrations to see the list of existing integrations.
  2. Click to open the phone-order-entry. This integration is saving phone orders to the database.

Save Phone Order to DB integration on the design console

  1. Click on TEST and enter the sample JSON payload below as input:
{"order_id": 10000}
  1. Click TEST INTEGRATION.

  2. Click on VIEW LOGS to check logs. Validate that the phone-entry integration is working as expected.

  3. Return to the Navigation menu select Integrations again to see the list of existing integrations.

  4. Click to open the order-entry. This integration is the main integration calling sub-integrations based on the order type. You will be modifying it to add some steps.

  5. Click on Enable Editing on the top right.

Enable editing button selected

Note: When clicking enable editing a window named Create New Version will pop up. For this lab click the Skip button.
  1. Click on Tasks and search for Call Integration. Pull the task out to the Integration designer console and drop next to the Complete Phone Order.

call in the search field Call Integration found in Flow Control

add call integration to ui.png

  1. Once completed, pull a fork from the Create Order task to the newly created Call Integration task.

fork pulled from Create Order to Call Integration

  1. Next, click the Call Integration task and change the Label to Complete Internet Order.
  2. In the Configuration section, add the provided information below.
  • Click into the API Trigger ID and select: api_trigger/internet-order-entry_API_1
  • Then select Run a single integration and then select the internet-order-entry integration name.
  • Click ADD next to Map to subintegration input(s):
    • Integration variable to map from: Task_6_connectorOutputPayload
    • Sub-integration input to map to: input
  • Execution Strategy: ASYNC

configurecallintegrationnew.png

Note: If you do not see the internet-order-entry under the Run a single integrationselections ensure you go back to the internet-order-entry integration and check that it has been Published so the order-entry integration can visibly see it. Note: To test the Complete Phone Order subintegration in a similar fashion you will need to make similar configuration changes on that task. Ensure that you change the API Trigger ID to api_trigger/phone-order-entry_API_1 & the Run a single integration: phone-order-entry integration name. This also includes changing the Map to subintegration input(s)
  1. Select the Edge coming from Create Order to Complete Internet Order. Change the Label name to Internet Order and add a condition.
$input.product_type$ = "INTERNET"

Click the line, called Edge, between Create Order and Complete Internet order then add the label Internet Order and condition

  1. Click on Publish and SKIP when asked to create a new version to deploy the order-entry integration.
  2. Then, click TEST and select API Trigger.

Test button and API Trigger button

  1. Enter the sample JSON payload below as input and click on TEST INTEGRATION to test the integration:
{"cart_id": "20400", "order_amount": 400.25, "customer_id": "5001", "product_type": "PHONE"} {"cart_id": "80300", "order_amount": 300.65, "customer_id": "6001", "product_type": "INTERNET"}

sample json code added with Test Integration button

  1. Click on VIEW LOGS to check the logs.

View Logs button selected

You are looking for an output that states that the Integration execution succeeded. If you want to trace every portion of the Integration workflow then looking at the logs will give you insight into every step of the process. If you are not met with a successful output then consider looking at the logs to see what information indicates the failure. Ensure that you re-check every step you’ve completed thus far and spell check each entry used up to this point.

Click Check my progress to verify your performed tasks.

View and modify an existing integration

Part 2: Add advanced features

Persona:  IPaaS Integration Developer

Use Case

You are an Integration Developer and have a requirement to modify an existing integration flow for the business. The existing integration flow works inline with order entry information pertaining to telecom products that your business delivers such as internet and phone services. The business has decided to add some advanced features to work inline with customer orders.

You are asked to implement approval logic to gain permissions from key leaders in the business for orders that traverse the Integration.

How can Application Integration help?

In this section, you will learn about Application Integration's Advanced features. You will use the Approval task and have the integration flow support the pre-configured sub-integrations with new logic and conditions that support the order inputs. You will:

  • Implement Approval logic to resume Integration workflow based on the order information.
  • Conditionally call the corresponding provisioning system based on the product ordered

Start off by adding the Approval logic into the existing integration workflow. You'll configure it according to the order amount information specified in the input variables that traverse the integration.

Approval logic workflow

Approval task

Configure the Approval task to email the outlined business manager(s) to review and approve the orders that meet a certain criteria the business has outlined.

Scenario

The business wants to route any orders greater than 10,000 for manager approval(s) via email. If the order amount is less than 10,000 then the order does not need approval and can traverse the integration and conditionally call the corresponding provisioning system based on the product that was ordered.

Task 1. Configure Approval task

  1. In the Application Integration console, open the order-entry integration.
Note: Ensure you click ENABLE EDITING to edit the Integration.
  1. Click the Tasks button at the top of the order-entry integration page.
  2. Search for the Approval task, then select it.

approval task block

  1. Pull the task out to the Integration designer console, and drop it right under both of the Phone & Internet orders.
Note:You'll be shifting the overall design later in this lab. approval task moved out of the flow
  1. Now you have to configure the Approval task to work inline with the existing Integration. Pull a Fork from the Create Order connector to the newly created Approval task.

fork from Create Order to Approval task

  1. Next, click the Edge that was created.

Edge between Create Order and Approval selected

  1. Fill out the Label and Condition information in the Edge window below.

Label: Manager Approval

Condition:

$input.order_amount$ >= 10000
  1. Now pull a fork from the Approval task to the Complete Internet Order.

Fork between Approval and Complete Interent Order

  1. Do the same for the Phone Order.

Fork between Approval and Complete Phone Order

Now that your Edges has been configured, move forward with configuring the Approval Task.

  1. Click on the Approval task and open it. You will only modify two sections of the task: The Recipients and the Custom notification message.

The Recipients email address will be a valid email address you have access to, like your personal or corporate email. Do not use the student temporary email address (ending in @qwiklabs.net), that email is inbox blocked from receiving/sending email.

Provide the following information:

  • Recipients: (valid email address)
  • Custom notification message: Hello, please review this order information and approve at your earliest convenience.

Approval email settings with custom message

With the Approval task now configured you will need to add the appropriate role in IAM (Identity and Access Management) to the Recipients you entered. You will be adding the Application Integration Approver & Apigee Integration Viewer role.

  1. Open the Google Cloud console by navigating to https://console.cloud.google.com/ in a new "Incognito browser tab".

  2. Once opened, copy the Project ID. You will be utilizing this for the next steps.

Location on the Project ID in the Google Cloud console

Note: Also take note of the Email Address you used previously in the Approval task. You will be using that as well in the next steps.
  1. Click the Activate Cloud Shell button.

activate cloud shell icon

  1. Click Continue.

Continue button in Cloud Shell

  1. Set the GOOGLE_CLOUD_PROJECT to the project id you copied in step 10 by replacing the value in the <> and executing the following command:
export GOOGLE_CLOUD_PROJECT=<Project ID>
  1. Set the RECIPIENT_EMAIL to the email address you used for the recipient(s) section by replacing the value in the <> and executing the following command:
export RECIPIENT_EMAIL=<Email Address>
  1. Now execute the following command to give your email account the Application Integration Approver role:
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member=user:$RECIPIENT_EMAIL --role=roles/integrations.suspensionResolver
  1. If this window pops up when executing the command in step 15 click Authorize and execute the command once again if an error arises.

authorization page

  1. Now execute the following command to give your email account the Apigee Integration Viewer role:
gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT --member=user:$RECIPIENT_EMAIL --role=roles/integrations.apigeeIntegrationsViewer
  1. Once the command has run successfully, click the Navigation menu in the top left of the console and navigate to IAM & Admin > IAM.

Google Cloud console Navigation menu IAM & Admin IAM selections

  1. Validate that the "Application Integration Approver" and "Apigee Integration Viewer" roles were correctly assigned to your student username.
IAM roles listed

Now that the appropriate IAM account has been put in place for approvals, move forward with testing the Approval task to see if it is configured correctly.

Click Check my progress to verify your performed tasks.

Configure Approval task

Test Approval task

  1. Return to the Application Integration console.

  2. Navigate back to the "order-entry" integration and click the "Test" button.

  3. Once the menu opens click "API Trigger". Click Publish and Test.

  4. Copy & Paste the provided JSON information below into the API Trigger and then click Test Integration.

You should be met with a message saying Integration execution succeeded.

{"cart_id": "20401", "order_amount": 10000, "customer_id": "5002", "product_type": "INTERNET"}
  1. Once successful, click View Logs to get more context into the Approval flow so that you can verify its functionality. Since the order_amount entered was >= 10000, the condition should Suspend the integration until the Approval process has been completed.

order-entry Suspended status

Do not close this log window, you will return to this window later in the lab. Proceed to the next step.

With this information you know that the Integration is currently in a Suspended state until the order that has the order amount details matching the previously configured condition is approved.

You will now check the Application Integration Recipients email you configured for an approval / rejection letter.

Task 2. Check recipient email

Note: It might be easiest to approve the email from a mobile device that has access to the recipient email used for this section.
  1. From your mobile device or a new Incognito tab, navigate to the email account you used for the Approval task and go to the Inbox.
Note: If you are using an gmail account as the recipient you may already be signed into the pre-provisioned qwiklabs.net email account. If so, please log out and sign in with your personal email. sign out page for qwiklabs.net student acct

Then sign in.

d266310c113fa268.png

  1. Look for an email with a subject line of [ACTION REQUIRED] and looks like this image below.

Action Required email from Application Integration

  1. Click the URL at the bottom of the email to get redirected to the Integration Execution Pause window. Once inside press the Approve button.

Integration Execution Paused page with Approve button selected

  1. You should get an Approval Status Change window stating that you can now move forward with the Integration flow.

Approval request APPROVED message

  1. Now return to the Google Cloud console, https://console.cloud.google.com/ in an Incognito browser and log back into the console with the pre-provisioned Username and Password for this lab.
  2. Once logged in, go back to the Log window tab you kept open of the order-entry integration. Once there, click the "Refresh Logs" button at the top of the page to get an updated status of the order-entry integration.

The updated logs after approving the request inside of the email should look like this. With this diagram you can now see that the Suspended state has been lifted via the email approval and that the Integration flow can proceed with conditionally calling the corresponding provisioning system based on the product ordered.

approval logs with Success status

Click Check my progress to verify your performed tasks.

Check recipient email

Task 3. Conditionally call the corresponding provisioning system

In this section you will learn how to conditionally call the corresponding provisioning system based on the product ordered from the initial JSON input.

Now that you have the Approval Task configured you can focus on the overall design. There is some logic that you need to add to support the overall integration flow.

Start off by modifying the pre-built edge conditions that work inline with the product order sub-integrations. You will modify Internet Order and Phone Order conditions to support the integration flow for the Suspend task.

workflow that shows 2 pre-built Edge conditions that will be modified

Modify the conditions

In this section, you'll modify the existing Phone Order and Internet Order conditions.

  1. In the Application Integration console, click the edge named Phone Order.

Phone Order Edge selected

  1. In the Phone Order edge window add the new condition information into the Condition box:
$input.product_type$ = "PHONE" AND $input.order_amount$ < 10000

phone order edge with new condition added

  1. Now click on the Internet Order edge and add the new condition information into the Condition box:
$input.product_type$ = "INTERNET" AND $input.order_amount$ < 10000

Internet Order Edge with new Condition added

  1. Now, both of the order conditions now focus on the product_type and the order_amount inputs (variables).

  2. The Integration Design is now complete, and the overall design should look like the image below. Ensure that the complete orders have enough space on the designer by pulling the orders out on the left and right sides of the designer.

Integration design workflow

Task 4. (Optional) Test the Integration workflow

You can test the Integration workflow you created up to this point. Ensure that the Integration is published before testing.

  1. Open the API Trigger and add the provided JSON information:
{"cart_id": "20401", "order_amount": 10000, "customer_id": "5002", "product_type": "INTERNET"}
  1. Click Test Integration. You should be met with a message saying Integration execution succeeded.

  2. Try to change the values of the product and order amount to see if the Integration is working as expected with the conditions that were previously set.

Congratulations

In Part 1, you learned how to create a new integration using the Application Integration platform, added a Trigger, a connector task, and Data Mapper, and viewed and modified an existing integration.

In Part 2, you created and configured an Approval task with logic to work in line with the order use case. You also added additional logic to support existing order conditions to support the overall Approval logic. This integration flow will now conditionally call the corresponding provisioning system based on the product ordered.

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual last updated May 23, 2024

Lab last tested May 23, 2024

Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.