简体   繁体   English

我如何在 wso2 ESB/EI 中向我的地址端点添加值

[英]how i can add values to my Adress endpoint in wso2 ESB/EI

i want to add values dynamically to adress endpoint in the proxy in wso2 ESB/EI我想动态添加值以在 wso2 ESB/EI 的代理中添加地址端点

<address uri="mqtt:/SampleProxy?mqtt.server.host.name=thingsboard.cloud&amp;mqtt.server.port=1883&amp;mqtt.client.id=esb.test.sender&amp;mqtt.topic.name=v1/devices/me/telemetry&amp;mqtt.subscription.qos=0&amp;mqtt.blocking.sender=true&amp;mqtt.subscription.username=25416990;">

lets say for exemple i want to add "test" at the end of the endpoint how i can do this?例如,我想在端点末尾添加“测试”我该怎么做?

For a similar problem, but with sending msg to rabbitmq, I created template, where i set exchangeName and routingKey dynamicaly.对于类似的问题,但是通过将 msg 发送到 rabbitmq,我创建了模板,我在其中动态设置了exchangeNameroutingKey In the same manner, you can create your own template.以同样的方式,您可以创建自己的模板。 You need to create Header named "To" and using XPATH concate interesting address endpoint, and for dynamic values you just use $func: {parameter name} Something like below:您需要创建名为“To”的 Header 并使用XPATH 连接有趣的地址端点,对于动态值,您只需使用$func: {parameter name}如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<template xmlns="http://ws.apache.org/ns/synapse" name="rabbitmq.sender">
   <parameter name="exchangeName"/>
   <parameter name="routingKey"/>
   <sequence>
      <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
      <header name="To"
              scope="default"
              expression="concat('rabbitmq:/?rabbitmq.connection.factory=CachedRabbitMQConnectionFactory&amp;rabbitmq.exchange.name=',$func:exchangeName,'&amp;rabbitmq.queue.routing.key=',$func:routingKey)"/>
      <send/>
   </sequence>
</template>

To use that, call-template mediator is needed.要使用它,需要调用模板中介。 In brackets you can put expression, like below:在括号中,您可以放置表达式,如下所示:

<call-template target="send.rabbitmq">
    <with-param name="exchangeName" value="test"/>
    <with-param name="routingKey" value="{get-property('testValue')}"/>
</call-template>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM