Studio中的Salesforce访问信息

Studio中的Salesforce访问信息

本文介绍了定义各种数据库Mule Anypoint Studio中的Salesforce访问信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows下运行Mule Anypoint Studio v6.2.4.我有一个从SQL Server DB获取数据记录并将其填充到Salesforce Org中的应用程序.该应用程序是使用示例开发的,在mule.{mule.env}.properties文件中定义的一个DB和一个SF参数的当前情况下可以正常工作.

I am running Mule Anypoint studio v6.2.4 under Windows. I have an application which gets data records from a SQL Server DB and populates them into Salesforce Org. The application was developed using examples and works fine in the current scenario of one DB and one SF parameters defined in mule.{mule.env}.properties file.

现在,我需要访问其他数据库以获取输入记录,并将其填充到其他Salesforce组织中.每次更改属性文件中的访问参数都很繁琐且容易出错. (例如4个DB和4个SF组织)

Now I need to access a different DB for input records and populate them to a different Salesforce org. Changing the access parameters in properties file every time is tedious and error prone. (e.g. 4 DB's & 4 SF Orgs}

我想做的是定义访问参数(用于各种SQL Server DB和Salesforce组织),将DbName和SFName指定为http查询参数,然后让Mule应用程序选择正确的连接参数.

What I would like to do is define access parameters (for various SQL Server DB and Salesforce Orgs), specify DbName and SFName as http query parameters, and let mule application pick the correct parameters for connection.

我将如何实现?详细信息将对我有所帮助,因为我还没有精通Mule.

How would I accomplish it? Details will help me as I am not that proficient in Mule yet.

谢谢

Kishore

推荐答案

您可以使用数据库连接的完整列表创建一个属性文件:

You could create one property file with a full list of the database connections:

#DB of puppies
postgres.puppies.user=mule
postgres.puppies.password=password
postgres.puppies.host=db-1
postgres.puppies.db=mule-puppies

#DB of cars
postgres.cars.user=mule
postgres.cars.password=password
postgres.cars.host=db-2
postgres.cars.db=mule-cars

已更新

然后,如果您想从加载您的属性之一的dataweave组件中读取查询参数:

UPDATED

Then, if yout want to read a query parameter from the dataweave component loading one of your Properties:

%dw 1.0
%output application/java
---
p("postgres." ++ inboundProperties."http.query.params"['db-name'] ++ ".user")

注意:考虑当QueryParameter.db-name为null时,您将获得一个异常(您应处理此异常),或者另一种处理方式是通过处理您自己的数据结构中的null ( https://forums.mulesoft.com/questions/28105/how-do-i-do-a-null-check-in-dataweave.html ),例如如果为null,则可以定义默认数据库

Note: Consider when QueryParameter.db-name is null you will get an exception (you should handle this exception), or, another way to do it, is by handling nulls from your own data-weave (https://forums.mulesoft.com/questions/28105/how-do-i-do-a-null-check-in-dataweave.html), e.g. when null you could define a default database

希望这有助于澄清

这篇关于定义各种数据库Mule Anypoint Studio中的Salesforce访问信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:56