final Map<String, Object> properties = new HashMap<String, Object>();
getEndpointProperties(endpoint.getConfiguration(), properties);
getExchangeProperties(exchange, properties);
// decide which method to invoke
final FacebookMethodsType method = findMethod(exchange, properties);
if (method == null) {
// synchronous failure
callback.done(true);
return true;
}
// create a runnable invocation task to be submitted on a background thread pool
// this way we avoid blocking the current thread for long running operations
Runnable invocation = new Runnable() {
@Override
public void run() {
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Invoking method {} with {}", method.getName(), properties.keySet());
}
Object result = FacebookMethodsTypeHelper.invokeMethod(
endpoint.getConfiguration().getFacebook(), method, properties);