如何判断camel交换对象的类型 [英] How to determine the type of the camel exchange object
本文介绍了如何判断camel交换对象的类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Web 服务器上运行了两个不同的服务.这两个服务都有一个名为xyz"的操作,带有以下参数.
I have two different services running on a web server. Both the services have an operation named 'xyz', with the following arguments.
服务 1:
公共字符串xyx(学生对象){}
服务 2:
public String xyz(Employee object){}
现在我有一个客户端,它将根据收到的消息调用这些服务之一的操作.该消息将作为骆驼交换接收.所以我需要识别消息的类型,然后调用相应的服务.
Now i have a client which will invoke the operation of one of these services based on the message that it receives. The message will be received as a camel exchange. So i need to identify the type of the message and then invoke the appropriate service.
我如何识别作为骆驼交换收到的消息的原始类型.
How do i identify the original type of the message that is received as a camel exchange.
谢谢.
推荐答案
或者你可以这样做:
from("foo:incommingroute")
.choice()
.when(simple("${body} is 'java.lang.String'"))
.to("webservice:Student")
.when(simple("${body} is 'foo.bar.Employee'"))
.to("webservice:Employee")
.otherwise()
.to("jms:Deadletter")
.end();
这篇关于如何判断camel交换对象的类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文