本文整理汇总了Java中org.mule.api.client.LocalMuleClient类的典型用法代码示例。如果您正苦于以下问题:Java LocalMuleClient类的具体用法?Java LocalMuleClient怎么用?Java LocalMuleClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocalMuleClient类属于org.mule.api.client包,在下文中一共展示了LocalMuleClient类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.mule.api.client.LocalMuleClient; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
String endpointUrlValue = this.getStringFromField(this.endpointUrl, execution);
String languageValue = this.getStringFromField(this.language, execution);
String payloadExpressionValue = this.getStringFromField(this.payloadExpression, execution);
String resultVariableValue = this.getStringFromField(this.resultVariable, execution);
LocalMuleClient client = this.getMuleContext().getClient();
ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
Object payload = scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);
MuleMessage message = new DefaultMuleMessage(payload, this.getMuleContext());
switch (this.mep) {
case REQUEST_RESPONSE:
MuleMessage resultMessage = client.send(endpointUrlValue, message);
Object result = resultMessage.getPayload();
if (resultVariableValue != null) {
execution.setVariable(resultVariableValue, result);
}
break;
case ONE_WAY:
client.dispatch(endpointUrlValue, message);
break;
default:
break;
}
this.leave(execution);
}