Mule Restlet 应用程序无法运行
这是嵌入在 Mule 中的 RESTful 接口,它接受用户名并输出“hello, $name”
以下是 mule-config.xml
<model name="greetingModel">
<service name="greetingService">
<inbound>
<inbound-endpoint address="http://localhost:9004"/>
</inbound>
<outbound>
<filtering-router>
<outbound-endpoint address="vm://greeting"/>
<restlet:uri-template-filter pattern="/hello/{set-payload.name}" verbs="GET"/>
</filtering-router>
</outbound>
</service>
<service name="greeting">
<inbound>
<inbound-endpoint address="vm://greeting" exchange-pattern="request-response"></inbound-endpoint>
</inbound>
<component class="com.ggd543.mulerestletdemo.GreetingComponent"></component>
</service>
</model>
和组件类
package com.ggd543.mulerestletdemo
import org.mule.api.lifecycle.Callable
import org.mule.api.MuleEventContext
class GreetingComponent extends Callable {
def onCall(eventContext: MuleEventContext) = {
val name = eventContext.getMessage.getPayload.asInstanceOf[String]
sayHello(name)
}
def sayHello(name: String) = {
val msg = "hello, "+name
println(msg)
msg
}
}
中的部分内容成功部署应用程序后,我尝试访问 http://localhost:9004/hello/archer 在我的浏览器中,但是什么也没发生。
有什么问题吗mule-config.xml ?
PS:我的 mule 版本是 3.1.2,我使用的是 mule-transport-restlet-1.1.3.jar
This is a RESTful interface embedding in Mule, which accepts a username and output "hello, $name"
The following is part of content in mule-config.xml
<model name="greetingModel">
<service name="greetingService">
<inbound>
<inbound-endpoint address="http://localhost:9004"/>
</inbound>
<outbound>
<filtering-router>
<outbound-endpoint address="vm://greeting"/>
<restlet:uri-template-filter pattern="/hello/{set-payload.name}" verbs="GET"/>
</filtering-router>
</outbound>
</service>
<service name="greeting">
<inbound>
<inbound-endpoint address="vm://greeting" exchange-pattern="request-response"></inbound-endpoint>
</inbound>
<component class="com.ggd543.mulerestletdemo.GreetingComponent"></component>
</service>
</model>
and the component class
package com.ggd543.mulerestletdemo
import org.mule.api.lifecycle.Callable
import org.mule.api.MuleEventContext
class GreetingComponent extends Callable {
def onCall(eventContext: MuleEventContext) = {
val name = eventContext.getMessage.getPayload.asInstanceOf[String]
sayHello(name)
}
def sayHello(name: String) = {
val msg = "hello, "+name
println(msg)
msg
}
}
After deploying the app successfully, I tried to visit http://localhost:9004/hello/archer in my browser, but nothing happened.
Is there anything wrong in the mule-config.xml
?
PS: My mule version is 3.1.2 and I am using mule-transport-restlet-1.1.3.jar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题是由于虚拟机端点上的交换模式不一致造成的。尝试:
The problem is due to inconsistent exchange-patterns on the VM endpoint. Try: