[
https://issues.apache.org/jira/browse/CAMEL-27963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27963:
--------------------------------
Description:
Found while improving the option descriptions of camel-whatsapp for CAMEL-23832
(commit
https://github.com/apache/camel/commit/1596a58f04251fa0baeff6ab9a6de9c64fb9d1c1,
pull request https://github.com/apache/camel/pull/31198).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. doStop drops the HttpClient and closes nothing
{{WhatsAppEndpoint.doStop}} sets httpClient = null without closing it, also
when the client was set by the user (endpoint or component option).
whatsappService is not reset, so after a restart it still uses the old client,
while doStart builds a new default HttpClient that nothing uses.
Proposed change: track whether the endpoint created the client; only then
close() it (HttpClient is AutoCloseable since Java 21) and reset both it and
the whatsappService the endpoint created.
h4. 2. The component phoneNumberId is not used but required
{{WhatsAppComponent.createEndpoint}} always takes the phone number ID from the
URI path and never reads the component phoneNumberId, which is marked
required=true. The component authorizationToken is also required=true although
an endpoint authorizationToken is enough.
Proposed change: deprecate phoneNumberId (or use it when the path is empty) and
drop required=true from both.
h4. 3. No request timeout
The request built in {{WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler}}
has no timeout, only the 10 s connect timeout of the default client, so a
server that accepts the connection and never answers leaves the exchange
pending forever.
Proposed change: add a requestTimeout option (HttpRequest.Builder.timeout).
h4. 4. Smaller issues
The checks configuration.getBaseUri() == null etc. in
WhatsAppComponent.createEndpoint are always true (the configuration was just
created). The apiVersion default v13.0 is a Graph API version Meta has retired.
The doc page says both producer and consumer are supported, but createConsumer
throws UnsupportedOperationException; events are received in webhook mode
(webhook:whatsapp:...). WhatsAppServiceRestAPIAdapter logs every response
status at INFO.
_Claude Code on behalf of davsclaus_
was:
Found while improving the option descriptions of camel-whatsapp for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31198).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. doStop drops the HttpClient and closes nothing
{{WhatsAppEndpoint.doStop}} sets httpClient = null without closing it, also
when the client was set by the user (endpoint or component option).
whatsappService is not reset, so after a restart it still uses the old client,
while doStart builds a new default HttpClient that nothing uses.
Proposed change: track whether the endpoint created the client; only then
close() it (HttpClient is AutoCloseable since Java 21) and reset both it and
the whatsappService the endpoint created.
h4. 2. The component phoneNumberId is not used but required
{{WhatsAppComponent.createEndpoint}} always takes the phone number ID from the
URI path and never reads the component phoneNumberId, which is marked
required=true. The component authorizationToken is also required=true although
an endpoint authorizationToken is enough.
Proposed change: deprecate phoneNumberId (or use it when the path is empty) and
drop required=true from both.
h4. 3. No request timeout
The request built in {{WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler}}
has no timeout, only the 10 s connect timeout of the default client, so a
server that accepts the connection and never answers leaves the exchange
pending forever.
Proposed change: add a requestTimeout option (HttpRequest.Builder.timeout).
h4. 4. Smaller issues
The checks configuration.getBaseUri() == null etc. in
WhatsAppComponent.createEndpoint are always true (the configuration was just
created). The apiVersion default v13.0 is a Graph API version Meta has retired.
The doc page says both producer and consumer are supported, but createConsumer
throws UnsupportedOperationException; events are received in webhook mode
(webhook:whatsapp:...). WhatsAppServiceRestAPIAdapter logs every response
status at INFO.
_Claude Code on behalf of davsclaus_
> camel-whatsapp: doStop drops a user HttpClient and closes nothing,
> phoneNumberId component option unused, no request timeout
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27963
> URL: https://issues.apache.org/jira/browse/CAMEL-27963
> Project: Camel
> Issue Type: Bug
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-whatsapp for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/1596a58f04251fa0baeff6ab9a6de9c64fb9d1c1,
> pull request https://github.com/apache/camel/pull/31198).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. doStop drops the HttpClient and closes nothing
> {{WhatsAppEndpoint.doStop}} sets httpClient = null without closing it, also
> when the client was set by the user (endpoint or component option).
> whatsappService is not reset, so after a restart it still uses the old
> client, while doStart builds a new default HttpClient that nothing uses.
> Proposed change: track whether the endpoint created the client; only then
> close() it (HttpClient is AutoCloseable since Java 21) and reset both it and
> the whatsappService the endpoint created.
> h4. 2. The component phoneNumberId is not used but required
> {{WhatsAppComponent.createEndpoint}} always takes the phone number ID from
> the URI path and never reads the component phoneNumberId, which is marked
> required=true. The component authorizationToken is also required=true
> although an endpoint authorizationToken is enough.
> Proposed change: deprecate phoneNumberId (or use it when the path is empty)
> and drop required=true from both.
> h4. 3. No request timeout
> The request built in {{WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler}}
> has no timeout, only the 10 s connect timeout of the default client, so a
> server that accepts the connection and never answers leaves the exchange
> pending forever.
> Proposed change: add a requestTimeout option (HttpRequest.Builder.timeout).
> h4. 4. Smaller issues
> The checks configuration.getBaseUri() == null etc. in
> WhatsAppComponent.createEndpoint are always true (the configuration was just
> created). The apiVersion default v13.0 is a Graph API version Meta has
> retired. The doc page says both producer and consumer are supported, but
> createConsumer throws UnsupportedOperationException; events are received in
> webhook mode (webhook:whatsapp:...). WhatsAppServiceRestAPIAdapter logs every
> response status at INFO.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)