oscerd commented on code in PR #1859: URL: https://github.com/apache/camel-kafka-connector/pull/1859#discussion_r4478761656
########## connectors/camel-kafka-connector-kamelet-fix-dependencies.properties: ########## @@ -27,4 +27,8 @@ global=org.apache.camel.kafkaconnector:camel-kafka-connector,org.apache.camel:ca #camel-sjms2=org.apache.activemq:activemq-client::runtime,org.apache.activemq:artemis-jms-client::runtime #exclude_camel-sjms2= #additional_properties_camel-sjms2=camel.component.sjms2.connection-factory=#class:org.apache.activemq.ActiveMQConnectionFactory,camel.component.sjms2.connection-factory.brokerURL=tcp://localhost:61616 -camel-elasticsearch-index-sink=org.apache.camel:camel-bean \ No newline at end of file +camel-elasticsearch-index-sink=org.apache.camel:camel-bean + +# the webhook-source kamelet only declares camel-platform-http, which has no HTTP server of its own: ship the +# embedded Camel Main HTTP server (Vert.x), started by setting camel.server.enabled=true in the connector config +camel-webhook-source=org.apache.camel:camel-platform-http-main Review Comment: Agreed: the swallowed bind failure is the root cause in all three cases, and the fix belongs in Camel's `VertxPlatformHttpServer`, so that `startServer()` fails and the task goes to FAILED instead of staying RUNNING. I filed it as [CAMEL-26606](https://issues.apache.org/jira/browse/CAMEL-26606), with the fix in apache/camel#29221. The connector picks it up once the fix lands on the 4.22.x line, so I didn't add webhook-specific checks or a task cap to the generic CKC glue. Until then, the Deployment section spells out: - `tasks.max=1`, since extra tasks on the same worker listen on nothing; - the restart and config-update race with in-flight requests; - that such a task keeps reporting `RUNNING`, with the log lines to check and the task restart that recovers it. _Claude Code on behalf of Andrea Cosentino_ ########## connectors/camel-kafka-connector-kamelet-fix-dependencies.properties: ########## @@ -27,4 +27,8 @@ global=org.apache.camel.kafkaconnector:camel-kafka-connector,org.apache.camel:ca #camel-sjms2=org.apache.activemq:activemq-client::runtime,org.apache.activemq:artemis-jms-client::runtime #exclude_camel-sjms2= #additional_properties_camel-sjms2=camel.component.sjms2.connection-factory=#class:org.apache.activemq.ActiveMQConnectionFactory,camel.component.sjms2.connection-factory.brokerURL=tcp://localhost:61616 -camel-elasticsearch-index-sink=org.apache.camel:camel-bean \ No newline at end of file +camel-elasticsearch-index-sink=org.apache.camel:camel-bean + +# the webhook-source kamelet only declares camel-platform-http, which has no HTTP server of its own: ship the +# embedded Camel Main HTTP server (Vert.x), started by setting camel.server.enabled=true in the connector config Review Comment: Done: the properties file now has `additional_properties_camel-webhook-source=camel.server.enabled=true,camel.server.fileUploadEnabled=false`. The regenerated connector returns both from `getConnectorDefaults()`, so a fresh install starts the server without extra options. The connector configuration still wins, because `CamelSourceConnector.taskConfigs()` applies it over the defaults, so `camel.server.enabled=false` still turns the server off. The page now explains the default-on listener, how to change the host, port and path, and what disabling the server does. _Claude Code on behalf of Andrea Cosentino_ ########## docs/modules/ROOT/pages/user-guide/webhook-source.adoc: ########## @@ -0,0 +1,144 @@ +[[WebhookSource-WebhookSource]] += Webhook Source Connector + +The `camel-webhook-source-kafka-connector` receives HTTP requests and writes them to Kafka. It is generated from the +https://camel.apache.org/camel-kamelets/latest/webhook-source.html[Webhook Source Kamelet], which consumes from the +https://camel.apache.org/components/latest/platform-http-component.html[Platform HTTP] component, and it ships the +embedded HTTP server of Camel Main, +https://camel.apache.org/components/latest/others/platform-http-main.html[camel-platform-http-main], which is based on +Vert.x. The server runs inside the Kafka Connect worker that runs the task of the connector. + +[#webhook-enabling-the-http-server] +== Enabling the HTTP server + +The embedded HTTP server is disabled by default. The connector passes its configuration to Camel Main, so the server +is enabled and configured with the `camel.server.*` options of +https://camel.apache.org/components/latest/others/main.html[Camel Main], set in the connector configuration: + +[width="100%",cols="2,5,^1",options="header"] +|=== +| Name | Description | Default +| camel.server.enabled | Starts the embedded HTTP server. The connector does not start without it. | false +| camel.server.host | The address the server binds to. | 0.0.0.0 +| camel.server.port | The port the server listens on. | 8080 +| camel.server.path | The context path, which prefixes the path of the connector. | / +| camel.kamelet.webhook-source.subpath | The path where the connector receives requests. | webhook +| camel.server.maxBodySize | The maximum size, in bytes, of a request body. | +|=== + +The value of a record is the request body, as a `byte[]`. The `ByteArrayConverter` writes it to the topic unchanged. Review Comment: Yes, this should be merged after #1852, as the description says: the page describes the behaviour with it. For 4.22.0, the workaround now uses the `CamelTypeConverterTransform`, since the `ByteArrayConverter` fails there with a `DataException`. On form bodies, a new paragraph says that form-urlencoded and multipart requests arrive as a `Map` of the fields, which also become headers, and that the standard converters can't write it: - the `JsonConverter` throws an NPE on the MAP schema; - the `ByteArrayConverter` throws a `DataException`; - the `StringConverter` writes `Map.toString()`. It recommends JSON payloads. The schema problem affects every source with a `Map` body, so it's tracked as #1861, with a fix in progress. _Claude Code on behalf of Andrea Cosentino_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
