本文整理汇总了Java中org.apache.camel.ExchangePattern.isOutCapable方法的典型用法代码示例。如果您正苦于以下问题:Java ExchangePattern.isOutCapable方法的具体用法?Java ExchangePattern.isOutCapable怎么用?Java ExchangePattern.isOutCapable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.camel.ExchangePattern
的用法示例。
在下文中一共展示了ExchangePattern.isOutCapable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asyncCallback
import org.apache.camel.ExchangePattern; //导入方法依赖的package包/类
private Future<Object> asyncCallback(final Endpoint endpoint, final ExchangePattern pattern, final Object body, final Synchronization onCompletion) {
Callable<Object> task = new Callable<Object>() {
public Object call() throws Exception {
Exchange answer = send(endpoint, pattern, createSetBodyProcessor(body));
// invoke callback before returning answer
// as it allows callback to be used without unit of work invoking it
// and thus it works directly from a producer template as well, as opposed
// to the unit of work that is injected in routes
if (answer.isFailed()) {
onCompletion.onFailure(answer);
} else {
onCompletion.onComplete(answer);
}
Object result = extractResultBody(answer, pattern);
if (pattern.isOutCapable()) {
return result;
} else {
// return null if not OUT capable
return null;
}
}
};
return getExecutorService().submit(task);
}
示例2: sendBody
import org.apache.camel.ExchangePattern; //导入方法依赖的package包/类
public Object sendBody(String endpointUri, ExchangePattern pattern, Object body) throws CamelExecutionException {
Endpoint endpoint = resolveMandatoryEndpoint(endpointUri);
Object result = sendBody(endpoint, pattern, body);
if (pattern.isOutCapable()) {
return result;
} else {
// return null if not OUT capable
return null;
}
}
示例3: sendBodyAndHeader
import org.apache.camel.ExchangePattern; //导入方法依赖的package包/类
public Object sendBodyAndHeader(Endpoint endpoint, ExchangePattern pattern, final Object body,
final String header, final Object headerValue) throws CamelExecutionException {
Exchange exchange = send(endpoint, pattern, createBodyAndHeaderProcessor(body, header, headerValue));
Object result = extractResultBody(exchange, pattern);
if (pattern.isOutCapable()) {
return result;
} else {
// return null if not OUT capable
return null;
}
}
示例4: sendBodyAndProperty
import org.apache.camel.ExchangePattern; //导入方法依赖的package包/类
public Object sendBodyAndProperty(Endpoint endpoint, ExchangePattern pattern, final Object body,
final String property, final Object propertyValue) throws CamelExecutionException {
Exchange exchange = send(endpoint, pattern, createBodyAndPropertyProcessor(body, property, propertyValue));
Object result = extractResultBody(exchange, pattern);
if (pattern.isOutCapable()) {
return result;
} else {
// return null if not OUT capable
return null;
}
}
示例5: isOutCapable
import org.apache.camel.ExchangePattern; //导入方法依赖的package包/类
/**
* Returns true if the given exchange pattern (if defined) can support OUT messages
*
* @param exchange the exchange to interrogate
* @return true if the exchange is defined as an {@link ExchangePattern} which supports
* OUT messages
*/
public static boolean isOutCapable(Exchange exchange) {
ExchangePattern pattern = exchange.getPattern();
return pattern != null && pattern.isOutCapable();
}