2016-07-23 6 views
0

私はラクダのgoogle-mail componentを使用して、自分のアカウントから最新のメールを取得しようとしています。具体的には、私はhistoryエンドポイントプレフィックスをリストエンドポイントに使用しています。私のルートはGoogle Mail Api私はoutput.Butを制御するために... startHistoryIdlabelIdなどのようなパラメータを使用することができ、どのように私はURIに渡すかということを指定します。このapache camelのgoogleメールコンポーネントのコンシューマに必要なパラメータを設定する方法

<route id="parseNewMails"> 
     <from uri="g-mail://history/list?userId=me&amp;consumer.delay=10000"/> 
     <!-- <setHeader headerName="CamelGoogleMail.startHistoryId"> 
      <constant>2938321</constant> 
     </setHeader> --> 
     <to uri="file://output1"/> 
</route> 

のように見えますか?



<from uri="g-mail://history/list?userId=me&amp;CamelGoogleMail.startHistoryId=291234&amp;consumer.delay=10000"/> 

OR

<from uri="g-mail://history/list?userId=me&amp;startHistoryId=291234&amp;consumer.delay=10000"/> 

動作しません。これは、このエラーがスローされます。

Failed to resolve endpoint: g-mail://history/list?CamelGoogleMail.startHistoryId=2938321&consumer.delay=10000&userId=me due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{CamelGoogleMail.startHistoryId=2938321}] 

EDIT :: 私は必要な依存関係が

<dependency> 
    <groupId>org.apache.camel</groupId> 
    <artifactId>camel-google-mail</artifactId> 
    <version>2.17.2</version> 
</dependency> 

<bean id="g-mail" class="org.apache.camel.component.google.mail.GoogleMailComponent"> 
    <property name="configuration"> 
     <bean class="org.apache.camel.component.google.mail.GoogleMailConfiguration"> 
      <property name="accessToken" value="xxx" /> 
      <property name="applicationName" value="Simple Sample" /> 
      <property name="clientId" value="xxx" /> 
      <property name="clientSecret" value="xxx" /> 
      <property name="refreshToken" value="xxx" /> 
      <property name="scopes" value="https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/gmail.modify,https://www.googleapis.com/auth/gmail.labels" /> 
      <!-- <property name="p12FileName" value="" /> 
      <property name="user" value="" /> --> 
     </bean> 
    </property> 
</bean> 

注構成されたコンポーネントを追加したが、その歴史の接頭辞とリストエンドポイントが機能する。そのちょうど私はstartHistoryIdパラメタを指定できません。

答えて

0

ラクダヘッダーにstartHistoryIdの値を設定してください。それは動作するはずです。

Any URI option can be provided in a message header for producer endpoints with a CamelGoogleMail. prefix.

+0

私は依存関係が追加されています。私がg-mailを使う理由はcozです。これは私がgoogle-mailコンポーネントを設定するのに使ったbeanのidです。元の質問を更新し、関連するスニペットを追加しました。 –

+0

startHistoryIdの値をラクダヘッダーに設定してください。それは動作するはずです。 "任意のURIオプションは、CamelGoogleMail。接頭辞付きプロデューサエンドポイントのメッセージヘッダーに提供できます。" – gnanagurus

+0

私も答えを更新しました – gnanagurus

関連する問題