【发布时间】:2016-03-05 11:42:45
【问题描述】:
我无法理解 Apache Camel。我需要从 Google Drive 中删除一个文件。下面是我的代码。
私有静态列表范围 = Arrays.asList("https://www.googleapis.com/auth/drive.file");
public static void main(String[] args ) throws Exception
{
CamelContext context = new DefaultCamelContext();
GoogleDriveConfiguration configuration = new GoogleDriveConfiguration();
configuration.setApplicationName("camel");
configuration.setClientId("..");
configuration.setClientSecret("..");
configuration.setScopes(scopes);
configuration.setAccessToken("..");
configuration.setRefreshToken("..");
GoogleDriveComponent googleDriveComponent = new GoogleDriveComponent();
googleDriveComponent.setConfiguration(configuration);
context.addComponent("google-drive", googleDriveComponent);
context.addRoutes(
new RouteBuilder()
{
@Override
public void configure() throws Exception
{
from("google-drive://drive-files/delete?fileId=..").log(LoggingLevel.INFO, "${body}");
}
});
context.start();
Thread.sleep(10000);
context.stop();
}}
请教一些东西。我做错了什么?
堆栈跟踪:
org.apache.camel.RuntimeCamelException: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found { “代码”:404, “错误”:[{ “域”:“全球”, “位置”:“文件”, “位置类型”:“其他”, "message" : "找不到文件:..", “原因”:“未找到” }], “消息”:“找不到文件:..” }
【问题讨论】:
-
camel 是关于集成,或帮助它们之间的各种系统的集成。虽然您可以使用骆驼 google-doc 组件,但如果您只想“删除 google doc 中的文件”,那么您可能应该使用其他东西。
-
感谢您的建议!我的主要任务——对付骆驼。我想完成这个程序。
标签: google-drive-api apache-camel