davsclaus opened a new pull request, #3228:
URL: https://github.com/apache/camel-kamelets/pull/3228
Part of #3170: `fhir-sink` takes timeouts, compression, `summary` and
`validationMode`; `fhir-source` takes a `delay`, an OAuth access token and a
proxy, and no longer requires `username` and `password`;
`ogcapi-features-action` takes timeouts; `splunk-hec-sink` can send to the raw
endpoint; `snmp-source` takes a timeout, retries, an initial delay and an SNMP
v3 context.
### The options
| Kamelet | Option | Template mapping | What it does |
|---|---|---|---|
| `fhir-sink` | `connectionTimeout` |
`connectionTimeout={{?connectionTimeout}}` | How long to wait for the
connection, in ms (10000 when unset). |
| `fhir-sink` | `socketTimeout` | `socketTimeout={{?socketTimeout}}` | How
long to wait for the answer to a request, in ms (10000 when unset). |
| `fhir-sink` | `compress` | `compress={{?compress}}` | Sends the resource
GZIP-compressed, with `Content-Encoding: gzip`. |
| `fhir-sink` | `summary` | `summary={{?summary}}` | Adds the FHIR
`_summary` parameter to every request, so the server answers with a short form.
Enum `COUNT`, `TEXT`, `DATA`, `TRUE`, `FALSE`. |
| `fhir-sink` | `validationMode` | `validationMode={{?validationMode}}` |
`NEVER` skips the read of `/metadata` before the first message. Enum `NEVER`,
`ONCE`. |
| `fhir-source` | `delay` | `delay={{?delay}}` | Time between two searches,
in ms (500 when unset). |
| `fhir-source` | `accessToken` | `accessToken=RAW({{?accessToken}})` |
OAuth access token, sent as `Authorization: Bearer`. Secret. |
| `fhir-source` | `proxyHost`, `proxyPort` | `proxyHost={{?proxyHost}}`,
`proxyPort={{?proxyPort}}` | HTTP proxy to reach the server through. |
| `fhir-source` | `proxyUser`, `proxyPassword` |
`proxyUser=RAW({{?proxyUser}})`, `proxyPassword=RAW({{?proxyPassword}})` |
Login to the proxy, answered to its 407. Credentials; the password is a secret.
|
| `ogcapi-features-action` | `connectTimeout` | `connectTimeout:
"{{?connectTimeout}}"` | How long to wait for the connection, in ms (up to 3
minutes when unset, or less when the operating system gives up first). |
| `ogcapi-features-action` | `responseTimeout` | `responseTimeout:
"{{?responseTimeout}}"` | How long to wait for the answer, in ms (3 minutes
when unset). |
| `splunk-hec-sink` | `splunkEndpoint` | `splunkEndpoint:
"RAW({{?splunkEndpoint}})"` | The HEC path, such as `/services/collector/raw`,
with optional query parameters. `pattern: ^/[^\s]*$`. |
| `snmp-source` | `snmpTimeout` | `timeout: "{{?snmpTimeout}}"` | How long
to wait for the answer to a poll, in ms (1500 when unset). Not named `timeout`,
which the `kamelet:` component takes (#3201). |
| `snmp-source` | `retries` | `retries: "{{?retries}}"` | How many times a
poll is sent again (2 when unset). |
| `snmp-source` | `initialDelay` | `initialDelay: "{{?initialDelay}}"` |
Time before the first poll, in ms (1000 when unset). |
| `snmp-source` | `snmpContextName` | `snmpContextName:
"RAW({{?snmpContextName}})"` | The SNMP v3 context to read. `pattern:
^[^\s]+$`. |
- **Defaults:** every new option is optional, with no `default`, as in
#3174. When they are unset, the optional placeholders drop them, and the
endpoint URIs are identical to `main`'s.
- **`fhir-source` `username` and `password` are no longer required.** They
were required, so a server without login needed dummy values, and an
`accessToken` could not be used alone: with both set, HAPI sends two
`Authorization` headers (`Basic` and `Bearer`), which the test below shows.
Their mapping changed from `{{username}}` to `{{?username}}` (still in
`RAW()`); a configuration that sets them works as before.
- **`fhir-sink`:** its proxy and `accessToken` options were already there;
the issue listed them for `fhir-source`.
- A login for ogcapi-features-action is left for a later PR.
- **`nominatim-geocode-action`: no language option.** The Camel `geocoder`
component has a `language` option, but its Nominatim producer does not use it:
it builds the `search` request itself (`q`, `format`, `addressdetails`,
`limit`) with its own HTTP client, and sends neither an `accept-language`
parameter nor the `Accept-Language` header of the message. A test with
`language=fr` and an `Accept-Language: fr` header showed neither in the
request. `serverUrl` cannot carry it either, as the producer appends `/search`
to it. This needs a change in Camel first (the Nominatim producer passing
`language` as `accept-language`), then the Kamelet can map it.
- **Descriptions:** each "Good to know" names the new options where they
change what the reader must know: the `/metadata` read and the 10-second
timeouts of `fhir-sink`; the login choices of `fhir-source`; the timeouts of
`ogcapi-features-action`; the event and raw endpoints of `splunk-hec-sink`;
what happens to a poll the device does not answer in `snmp-source`.
- **Partial pages:** `fhir-sink`, `fhir-source`, `snmp-source` and
`splunk-hec-sink` have a new section with an example; `ogcapi-features-action`
gets a partial page, with an example of the timeouts.
### Verification
Tested with Camel JBang 4.24.0-SNAPSHOT:
- FHIR: `hapiproject/hapi:v8.12.0-2`, with a small recording HTTP server in
front of it (a reverse proxy that logs each request with its headers, or an
HTTP forward proxy that asks for a login with 407).
- Splunk: `splunk/splunk:latest` with HEC enabled
(`SPLUNK_START_ARGS=--accept-license`, `SPLUNK_HEC_TOKEN`), searched through
its REST API.
- SNMP: net-snmp `snmpd`, with a v1/v2c community, an SNMP v3 user and a
context `vrfblue` (a `proxy -Cn vrfblue` that maps `1.3.6.1.4.1.9999.1` to the
system group). The `polinux/snmpd` and Alpine `net-snmp` containers answered
from inside Docker but not through the published UDP port on Docker Desktop for
Mac, so the agent ran as the `snmpd` of macOS (net-snmp 5.6) on
`127.0.0.1:16161`. A UDP listener on a port without an agent recorded the polls
that were not answered.
- Nominatim and OGC API: the recording HTTP server as a stub, answering
canned JSON, or answering after a delay.
| Case | Result |
|---|---|
| All five Kamelets, options unset, `main` and this branch | `camel get
endpoint` shows identical URIs |
| All options set | Each reaches the endpoint URI, such as
`fhir://CREATE/resource?compress=true&connectionTimeout=4000&…&socketTimeout=7000&summary=DATA&validationMode=NEVER`
and
`snmp://…?initialDelay=…&retries=0&snmpContextName=RAW(vrfblue)&…&timeout=500` |
| `fhir-sink` unset | `GET /fhir/metadata`, then `POST
/fhir/Patient?_format=json`, no `Content-Encoding` |
| `fhir-sink` `compress: true`, `summary: DATA`, `validationMode: NEVER` |
No `/metadata`; `POST /fhir/Patient?_format=json&_summary=data` with
`Content-Encoding: gzip`; HAPI created the Patient (201) |
| `fhir-sink` `summary` unset / `TRUE`, Patient with text and a photo |
Answer: photo 1, text present, no tag / photo 0, no text, tag `SUBSETTED`. A
read of the Patient created with `TRUE` has its photo and text |
| `fhir-sink` `connectionTimeout` unset / `2000`, server `10.255.255.1` |
Fails after 10.3 s / 2.3 s, `ConnectTimeoutException` |
| `fhir-sink` `socketTimeout` unset / `2000`, server answering after 5 s |
Succeeds after 5.3 s / fails after 2.3 s, `SocketTimeoutException: Read timed
out` |
| `fhir-sink` `validationMode` unset / `NEVER`, server without `/metadata` |
Fails with `HAPI-1357: Failed to retrieve the server metadata statement` / the
Patient is sent |
| `fhir-source` without `username` and `password`, `main` / this branch |
Does not start: `mandatory parameters must be provided: username, password` /
searches, no `Authorization` header |
| `fhir-source` `delay` unset / `3000` | A search every 0.5–0.6 s / every
3.0 s |
| `fhir-source` `accessToken: tok-abc.123` | Every request has
`Authorization: Bearer tok-abc.123` |
| `fhir-source` `accessToken` with `username` and `password` | Every request
has two `Authorization` headers, `Basic dTpw` and `Bearer tok-abc.123` |
| `fhir-source` `username` and `password`, `main` and this branch |
`Authorization: Basic dTpw` on both |
| `fhir-source` `accessToken: "tok+a b%20&x=1"` | Sent as written: `Bearer
tok+a b%20&x=1` |
| `fhir-source` `proxyHost`/`proxyPort` to a proxy asking for a login, no
`proxyUser` | Every search fails with `HTTP 407 Proxy Authentication Required` |
| The same with `proxyUser: pu`, `proxyPassword: pp` | The proxy sees each
request first without, then with `Proxy-Authorization: Basic cHU6cHA=`; the
Bundles come through. Without the proxy options, the proxy sees nothing |
| `ogcapi-features-action` unset | One request; features come through |
| `responseTimeout` unset / `2000`, service answering after 5 s | Succeeds
after 5.0 s / fails after 2.0 s, `SocketTimeoutException: Read timed out` |
| `connectTimeout` `2000`, service `10.255.255.1` | Fails after 2.0 s,
`ConnectTimeoutException` |
| `connectTimeout` unset, service `10.255.255.1` | Fails after 75 s, when
macOS gives up the connection (the component waits up to 3 minutes) |
| `responseTimeout` unset, service answering after 400 s | Fails after 180
s, `SocketTimeoutException: Read timed out` |
| `nominatim-geocode-action` stand-in, Camel `geocoder` with `language=fr`
and a message header `Accept-Language: fr` | The request is `GET
/search?q=…&addressdetails=1&format=jsonv2&limit=1`, without `accept-language`
and without an `Accept-Language` header; no option added |
| `splunk-hec-sink` `splunkEndpoint` unset / `/services/collector/event` |
Indexed in `main` with source `w5-…` and source type `camel`; the event is
`{"headers":{"Order":"42"},"body":"hello-…"}` |
| `splunkEndpoint: /services/collector/raw` | Indexed with source
`http:splunk_hec_token`, source type `httpevent`; the event is the whole JSON
object, with `index`, `source` and `event` inside it |
| `splunkEndpoint:
/services/collector/raw?sourcetype=_json&source=w5-rawq-query` | Source
`w5-rawq-query`, source type `_json`: the query parameters (with `?` and `&`,
kept by `RAW()`) reach Splunk |
| `splunkEndpoint: /services/collector/raw?index=summary&sourcetype=_json`,
`index: main` | Indexed in `summary` |
| `splunkEndpoint: /services/collector/nope` | Fails with `HTTP/1.1 404 Not
Found` |
| `snmp-source` unset | First message 0.96 s after the route started:
`sysName` |
| `initialDelay: 5000` | First message 4.95 s after the route started |
| No agent, `snmpTimeout` and `retries` unset | 3 requests, 1.5 s apart, no
message |
| `snmpTimeout: 500`, `retries: 0` | 1 request |
| `snmpTimeout: 500`, `retries: 4` | 5 requests, 0.5 s apart |
| `snmpTimeout: 3000`, `retries: 1` | 2 requests, 3.0 s apart |
| SNMP v3, OID `1.3.6.1.4.1.9999.1.5.0`, `snmpContextName` unset / `vrfblue`
/ `nosuch` | `noSuchObject` / `w5misca-snmpd` / `noSuchObject` |
| SNMP v2c with `snmpContextName: vrfblue` | `noSuchObject`: the context is
only sent with v3 |
`./mvnw clean verify -DskipTests` and then `./mvnw clean verify` passed from
the root, including `KameletsCatalogTest` and `CatalogValidatorTest`. Before
building, the library copies of the five Kamelets were refreshed with `./mvnw
-pl library/camel-kamelets resources:copy-resources@copy-resource-one`. The
build regenerated `kamelets-index.json`. The partial pages have no unescaped
`${`.
_Claude Code on behalf of Claus Ibsen_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]