Getting started Community Training Tutorials Documentation APIs, AI & Tools
config.consumerKey=<consumerkey> config.consumerSecret=<consumersecret>
The following examples show several Mule flows for Google BigQuery Connector:
To secure connections, you must specify the OAuth connection field values. To do this:
Create a configuration file that includes properties for a connection:
Create a file named mule-app.properties in the /src/main/resources/ folder.
In the mule-app.properties file, create a set of properties for the connection,
similar to the ones that follow, replacing the bracketed text (including the brackets)
with the correct values for your configuration:
config.consumerKey=<consumerkey> config.consumerSecret=<consumersecret>
This may vary depending on the selected connection configuration.
For more information about creating a properties file, refer to Configuring Property Placeholders.
Configure global elements for connection:
Create a new Mule project.
In the Mule Palette view, click Search in Exchange and enter google bigquery.
Add Google BigQuery Connector to the Selected modules section and click Finish.
Click the Global Elements tab and click Create.
Select Connector Configuration > Google BigQuery Config and click OK.
Enter the values to configure either JWT or OAuth2. For more information about what values to enter in the fields for the connector configuration, see Configure a Global Element for the Connector.
Click the Test Connection button to ensure there is connectivity with the Google API. A successful message should pop up.
Click OK.
Open the HTTPS Listener config in Global Element Configuration.
Click the TLS tab and select TLS Configuration > Edit inline.
Specify the Key Store Configuration with the generated keystore details to enable HTTPS on this configuration.
Click OK.
Configure a global element for the mule-app.properties file so that Mule knows
where to find it:
Click the Global Elements tab and click Create.
In the Choose Global Type dialog, select Configuration properties and click OK.
In the File field, enter mule.app.properties.
Click OK.
This Mule flow retrieves a job from the given job ID.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Get Job
Gets a job
Enter the following values:
| Field | Value |
|---|---|
Job Id |
|
Logger
Shows the HTTP response from the Get Job operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="getQueryFlow"
>
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/get" />
<bigquery:get-job doc:name="Get Job"
jobId="#[attributes.queryParams.jobId]"
config-ref="BigQuery__Configuration" />
<logger level="INFO" doc:name="Logger"
/>
</flow>
</mule>
This Mule flow inserts a job using the input configuration.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Insert Job
Insert a job
Enter the following values:
| Field | Value |
|---|---|
Job values content |
|
Logger
Shows the HTTP response from the Insert Job operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="insertJobFlow"
>
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/insert" />
<bigquery:insert-job doc:name="Insert Job"
config-ref="BigQuery__Configuration">
<bigquery:job-values-content><![CDATA[#[payload]]]></bigquery:job-values-content>
</bigquery:insert-job>
<logger level="INFO" doc:name="Logger"
/>
</flow>
</mule>
This Mule flow deletes a job from the given job ID.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Delete Job
Deletes a job
Enter the following values:
| Field | Value |
|---|---|
Job Id |
|
Logger
Shows the HTTP response from the Delete Job operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="deleteJobFlow">
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/delete" />
<bigquery:delete-job doc:name="Delete Job"
config-ref="BigQuery__Configuration"
jobId="#[attributes.queryParams.jobId]" />
<logger level="INFO" doc:name="Logger" />
</flow>
</mule>
This Mule flow retrieves results of a query.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Get Query Results
Get results of a query
Enter the following values:
| Field | Value |
|---|---|
Job Id |
|
Start Index |
|
Max Results |
|
Logger
Shows the HTTP response from the Get Query Results operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="getQueryResultFlow">
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/get/results" />
<bigquery:get-query-results doc:name="Get Query Result Paged" config-ref="BigQuery__Configuration" maxResults="25" jobId="#[attributes.queryParams.jobId]">
<ee:repeatable-file-store-iterable inMemoryObjects="1000" />
</bigquery:get-query-results>
<logger level="INFO" doc:name="Logger"
message="#[payload]" />
</flow>
</mule>
This Mule flow cancels a job from the given job ID.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Cancel Job
Cancels a job
Enter the following values:
| Field | Value |
|---|---|
Job Id |
|
Content Type |
|
Logger
Shows the HTTP response from the Cancel Job operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="cancelJobFlow">
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/cancel" />
<bigquery:cancel-job doc:name="Cancel Job"
config-ref="BigQuery__Configuration"
jobId="#[attributes.queryParams.jobId]" />
<logger level="INFO" doc:name="Logger" />
</flow>
</mule>
This Mule flow retrieves jobs from the project.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
List Jobs
Lists jobs
Enter the following values:
| Field | Value |
|---|---|
Content Type |
|
Max Results |
|
Pretty Print |
|
Logger
Shows the HTTP response from the List Jobs operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="listJobsFlow">
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/list" />
<bigquery:list-jobs doc:name="List Jobs"
config-ref="BigQuery__Configuration" />
<logger level="INFO" doc:name="Logger" />
</flow>
</mule>
This Mule flow executes the query given in the query job values.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Query
Executes a query
Enter the following values:
| Field | Value |
|---|---|
Query values content |
|
For Each
Iterates through multiple components
Enter the following values:
| Field | Value |
|---|---|
Counter Variable Name |
|
Batch Size |
|
Root Message Variable Name |
|
Transform Message
Outputs the results of the Query operation in JSON format
%dw 2.0
output application/json
var resultt = read(payload."output","application/json")
---
((resultt.f) map ((item, index) ->
{(payload.attributes.tableSchema.fields[index].name as String) : item.v}
))
reduce ((item, accumulator) -> accumulator ++ item)
Logger
Shows the HTTP response from the Query operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:google-drive="http://www.mulesoft.org/schema/mule/google-drive"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd
http://www.mulesoft.org/schema/mule/google-drive http://www.mulesoft.org/schema/mule/google-drive/current/mule-google-drive.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="queryFlow">
<http:listener doc:name="Listener"
config-ref="HTTP_Listener_config" path="/query" />
<bigquery:query doc:name="Run Query create schema" config-ref="BigQuery__Configuration" responseTimeout="300" responseTimeoutUnit="SECONDS" >
<bigquery:query-values-content ><![CDATA[#[%dw 2.0
output application/json
---
payload]]]></bigquery:query-values-content>
</bigquery:query>
<foreach doc:name="For Each" >
<ee:transform doc:name="Transform Message">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
var resultt = read(payload."output","application/json")
---
((resultt.f) map ((item, index) ->
{(payload.attributes.tableSchema.fields[index].name as String) : item.v}
))
reduce ((item, accumulator) -> accumulator ++ item)
]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Logger" message="#[payload]"/>
</foreach>
</flow>
</mule>
This Mule flow uses the On Table Row source.
This example uses the following operations:
On Table Row
Returns all rows of a table based on a watermark
Enter the following values:
| Field | Value |
|---|---|
Scheduling Strategy |
|
Frequency |
|
Start delay |
|
Time unit |
|
Dataset name |
|
Table name |
|
Watermark column |
|
Since |
|
Column id |
|
Logger
Shows the HTTP response from the On Table Row source
Transform Message
Outputs the results of the On Table Row source in JSON format
%dw 2.0 output application/json --- payload
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="onTableRow">
<bigquery:on-table-row doc:name="On Table Row"
config-ref="BigQuery__Configuration" datasetName="test124"
tableName="table_data" watermarkColumn="id" since="'1'"
columnId="id">
<scheduling-strategy>
<fixed-frequency />
</scheduling-strategy>
</bigquery:on-table-row>
<logger level="INFO" doc:name="Logger" />
<ee:transform doc:name="Transform Message">
<ee:message>
<ee:set-payload><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>
This Mule flow authorizes the connection.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Request
Consumes an HTTP service
Enter the following values:
| Field | Value |
|---|---|
Method |
|
Path |
|
Body |
|
Logger
Shows the HTTP response from the Request operation
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="authorize">
<http:listener doc:name="/authorize"
config-ref="HTTP_Listener_config" path="/authorize">
<http:response>
<http:headers><![CDATA[#[{'content-type' : 'text/html'}]]]></http:headers>
</http:response>
</http:listener>
<http:request method="GET" doc:name="Request"
config-ref="HTTP_Request_configuration"
path="/authorize?resourceOwnerId=demo">
</http:request>
<logger level="INFO" doc:name="Logger"
message="#[payload]" />
</flow>
</mule>
This Mule flow renders the HTML form.
This example uses the following operations:
HTTP Listener
Accepts data from HTTP requests
Parse Template
Processes a template
Enter the following values:
| Field | Value |
|---|---|
Location |
|
Paste this code into the Studio XML editor to quickly load the flow for this example into your Mule app:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:os="http://www.mulesoft.org/schema/mule/os"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:bigquery="http://www.mulesoft.org/schema/mule/bigquery"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:secure-properties="http://www.mulesoft.org/schema/mule/secure-properties"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/bigquery http://www.mulesoft.org/schema/mule/bigquery/current/mule-bigquery.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/os http://www.mulesoft.org/schema/mule/os/current/mule-os.xsd
http://www.mulesoft.org/schema/mule/secure-properties http://www.mulesoft.org/schema/mule/secure-properties/current/mule-secure-properties.xsd">
<secure-properties:config name="Secure_Properties_Config_demo" doc:name="Secure Properties Config" file="mule-artifact.properties" key="mulesoft" >
<secure-properties:encrypt algorithm="Blowfish" />
</secure-properties:config>
<configuration-properties
file="mule-artifact.properties" />
<http:request-config
name="HTTP_Request_configuration"
doc:name="HTTP Request configuration"
>
<http:request-connection host="127.0.0.1"
port="8087"/>
</http:request-config>
<http:listener-config name="HTTP_Listener_config"
doc:name="HTTP Listener config"
>
<http:listener-connection host="0.0.0.0"
port="8082" />
</http:listener-config>
<http:listener-config
name="HTTP_Listener_config1_Test" doc:name="HTTP Listener config">
<http:listener-connection host="127.0.0.1"
port="8087" usePersistentConnections="false"
connectionIdleTimeout="4000" />
</http:listener-config>
<bigquery:config name="BigQuery__Configuration"
doc:name="BigQuery Configuration"
>
<bigquery:oauth2-connection projectId="${config.projectId}">
<bigquery:oauth-authorization-code
consumerKey="${secure::config.consumerKey}"
consumerSecret="${secure::config.consumerSecret}"
resourceOwnerId="demo" />
<bigquery:oauth-callback-config
listenerConfig="HTTP_Listener_config1_Test" callbackPath="/callback"
authorizePath="/authorize" />
</bigquery:oauth2-connection>
</bigquery:config>
<flow name="html-form-flow">
<http:listener doc:name="/"
config-ref="HTTP_Listener_config" path="/">
<http:response>
<http:headers><![CDATA[#[{'content-type' : 'text/html'}]]]></http:headers>
</http:response>
</http:listener>
<parse-template doc:name="Parse Template"
location="index.html" />
</flow>
</mule>