Google Mail
Send, read and manage the messages, drafts, threads and labels of a Google Mail (Gmail) mailbox with the Gmail API.
What’s inside
-
Google Mail component, URI syntax:
google-mail:apiName/methodName -
Google Mail Stream component, URI syntax:
google-mail-stream:index
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-google-mail-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 34 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.google-mail-stream.access-token | The OAuth 2.0 access token. An access token typically expires after an hour, so set refreshToken for long-running use. | String | |
camel.component.google-mail-stream.application-name | The name of the application, sent to Google in the User-Agent header of each request, for example camel-google-mail/1.0. | String | |
camel.component.google-mail-stream.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.google-mail-stream.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.google-mail-stream.client-factory | To use a custom GoogleMailClientFactory as factory for creating the client. The default is BatchGoogleMailClientFactory. The option is a org.apache.camel.component.google.mail.GoogleMailClientFactory type. | GoogleMailClientFactory | |
camel.component.google-mail-stream.client-id | The OAuth 2.0 client ID of the application. | String | |
camel.component.google-mail-stream.client-secret | The OAuth 2.0 client secret of the application. | String | |
camel.component.google-mail-stream.configuration | The shared configuration of the component, whose options are the defaults of the options of each endpoint. The option is a org.apache.camel.component.google.mail.stream.GoogleMailStreamConfiguration type. | GoogleMailStreamConfiguration | |
camel.component.google-mail-stream.delegate | The email address of the user to impersonate with domain-wide delegation of the service account (serviceAccountKey). | String | |
camel.component.google-mail-stream.enabled | Whether to enable auto configuration of the google-mail-stream component. This is enabled by default. | Boolean | |
camel.component.google-mail-stream.health-check-consumer-enabled | Used for enabling or disabling all consumer based health checks from this component | true | Boolean |
camel.component.google-mail-stream.health-check-producer-enabled | Used for enabling or disabling all producer based health checks from this component. Notice: Camel has by default disabled all producer based health-checks. You can turn on producer checks globally by setting camel.health.producersEnabled=true. | true | Boolean |
camel.component.google-mail-stream.labels | Comma-separated names of the labels a mail must have to be consumed (all of them), such as INBOX or the name of a user label. The names are matched ignoring case; a name that matches no label of the mailbox is ignored. | String | |
camel.component.google-mail-stream.mark-as-read | Whether to mark the mail as read (remove the UNREAD label) when its exchange completes. When the exchange fails, the mail is marked as unread. | true | Boolean |
camel.component.google-mail-stream.max-results | The maximum number of mails to consume per poll. Gmail accepts at most 500. | 10 | Long |
camel.component.google-mail-stream.query | The Gmail search query that selects the mails to consume, in the format of the Gmail search box, for example is:unread from:example.com. | is:unread | String |
camel.component.google-mail-stream.raw | Whether to put the entire mail in the message body as an RFC 2822 formatted and base64url encoded String (the raw field of the Gmail message). When false, the body is the decoded text of the first part of the mail that has data. In raw mode, the subject, from, to, cc, bcc and Message-ID headers are not set. | false | Boolean |
camel.component.google-mail-stream.refresh-token | The OAuth 2.0 refresh token. With it, the component obtains a new access token whenever the current one expires, which a long-running application needs. | String | |
camel.component.google-mail-stream.scopes | The OAuth 2.0 scopes, separated by comma, that set the access the application has to the mailbox, such as https://www.googleapis.com/auth/gmail.readonly. See https://developers.google.com/identity/protocols/oauth2/scopes for the scopes of the Gmail API. | String | |
camel.component.google-mail-stream.service-account-key | The key of a service account, in JSON format, to authenticate as that service account. A key encoded in Base64 is accepted with the prefix base64:. | String | |
camel.component.google-mail.access-token | The OAuth 2.0 access token. An access token typically expires after an hour, so set refreshToken for long-running use. | String | |
camel.component.google-mail.application-name | The name of the application, sent to Google in the User-Agent header of each request, for example camel-google-mail/1.0. | String | |
camel.component.google-mail.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.google-mail.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.google-mail.client-factory | To use a custom GoogleMailClientFactory as factory for creating the client. The default is BatchGoogleMailClientFactory. The option is a org.apache.camel.component.google.mail.GoogleMailClientFactory type. | GoogleMailClientFactory | |
camel.component.google-mail.client-id | The OAuth 2.0 client ID of the application. | String | |
camel.component.google-mail.client-secret | The OAuth 2.0 client secret of the application. | String | |
camel.component.google-mail.configuration | The shared configuration of the component, whose options are the defaults of the options of each endpoint. The option is a org.apache.camel.component.google.mail.GoogleMailConfiguration type. | GoogleMailConfiguration | |
camel.component.google-mail.delegate | The email address of the user to impersonate with domain-wide delegation of the service account (serviceAccountKey). | String | |
camel.component.google-mail.enabled | Whether to enable auto configuration of the google-mail component. This is enabled by default. | Boolean | |
camel.component.google-mail.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.google-mail.refresh-token | The OAuth 2.0 refresh token. With it, the component obtains a new access token whenever the current one expires, which a long-running application needs. | String | |
camel.component.google-mail.scopes | The OAuth 2.0 scopes, separated by comma, that set the access the application has to the mailbox, such as https://www.googleapis.com/auth/gmail.readonly. See https://developers.google.com/identity/protocols/oauth2/scopes for the scopes of the Gmail API. | String | |
camel.component.google-mail.service-account-key | The key of a service account, in JSON format, to authenticate as that service account. A key encoded in Base64 is accepted with the prefix base64:. | String |