[英]WSO2 ESB JIRA connector
in my use case i need to write a proxy in which i can dynamically build a jira issue catching the data from the request sent to the same proxy. 在我的用例中,我需要编写一个代理,在其中我可以动态构建一个jira问题来捕获发送到同一代理的请求中的数据。 In the payload of the request there is a Json object like this:
在请求的有效负载中,有一个Json对象,如下所示:
{"objId":"073456","user":"sysadmin","message":"asdas"}
From this json i want to build this jira "CreateIssue" statement: 从这个JSON,我想建立这个吉拉“ CreateIssue”声明:
<jira.createIssue>
<projectKey>MY PROJECT</projectKey>
<summary>Issue sent form user: USER related to object: OBJID </summary>
<description>MESSAGE</description>
<issueType>Bug</issueType>
</jira.createIssue>
where USER, OBJID and MESSAGE are picked up from the json above. 从上面的json中提取USER,OBJID和MESSAGE。 How can i do it?
我该怎么做?
You can use property mediator to picked up from the json above. 您可以使用属性中介器从上面的json中进行选择。
<property name="objId" expression="json-eval($.objId)"/>
<property name="user" expression="json-eval($.user)"/>
<property name="OBJID" expression="get-property('OBJID')"/>
<jira.createIssue>
<projectKey>MY PROJECT</projectKey>
<summary>Issue sent form user: {$ctx:user} related to object: {$ctx:objId} </summary>
<description>MESSAGE</description>
<issueType>Bug</issueType>
</jira.createIssue>
You can use braces to specify dynamic values and xpath or JSON path (with "json-eval") to manipulate message payload, samples : 您可以使用花括号来指定动态值,并可以使用xpath或JSON路径(带有“ json-eval”)来处理消息有效负载,示例:
<summary>{concat('Issue sent form user: ', json-eval($.user), ' related to object: ', json-eval($.objId)}</summary>
<summary>{concat('Issue sent form user: ', //user/text(), ' related to object: ', //objId/text()}</summary>
see https://docs.wso2.com/display/ESB481/JSON+Support for more details 有关更多详细信息,请参见https://docs.wso2.com/display/ESB481/JSON+Support
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.