davsclaus opened a new pull request, #28327:
URL: https://github.com/apache/camel/pull/28327
Stacked on #28314. This group covers the components most used in the example
routes that still had no catalog body types (CAMEL-24961): as2, jdbc (and
spring-jdbc, whose endpoint extends it), smooks, vertx-http, tika, snmp, pdf,
file-watch, scp, graphql and micrometer.
**What the catalog says now**
| Component | Consumer | Producer input | Producer output |
|---|---|---|---|
| as2 | server/listen: the EDI message as `text`, or a stream with the
base64 or binary transfer encoding; receipt/receive: the receipt (MDN) entity |
`any`; with inBody=ediMessage, text or a stream | the receipt entity when
dispositionNotificationTo asks for one, else no body |
| jdbc, spring-jdbc | | the SQL statement as text, bytes, a stream or a file
| a select: a List of Maps; SelectOne: the Map, the value of its one column, or
no body; StreamList: an iterator; `unchanged` for a statement that is not a
select |
| smooks | | text, bytes, a stream or a file | `unknown`: what the exports
of the Smooks config give |
| vertx-http | | no body, text, bytes, a stream or a file | bytes, or no
body |
| tika | | text, bytes, a stream or a file | parse: a
`ByteArrayOutputStream` (`pojo`); detect: the media type as `text` |
| snmp | the PDU as XML `text` | `any`; an SNMP4J `PDU` for TRAP | POLL: an
`SnmpMessage`; GET_NEXT: a List of them; TRAP: `unchanged` |
| pdf | | create and append: text, bytes, a stream or a file; extractText:
the PDF as bytes, a stream, a file or a PDDocument; merge: `any` | create,
append and merge: a `ByteArrayOutputStream`; extractText: `text` |
| file-watch | the `java.io.File` of the event | | |
| scp | | text, bytes, a stream or a file; also no body with allowNullBody |
`unchanged` |
| graphql | | the query as text, bytes, a stream or a file, when none of
query, queryFile and queryHeader is set | the response as `text`, or no body |
| micrometer | | `any` | `unchanged` |
**Checked at runtime.** Routes run with `camel run` logged the class of the
body after each step, with text, bytes, streams, files, Maps, Lists, POJOs and
no body. Local servers where needed: an H2 data source, a fake HTTP server, an
SSH server with scp (Apache MINA SSHD), an SNMP agent (SNMP4J), and the as2
server and receipt consumer of the component itself.
- **as2:**
- client/send takes text or a stream; bytes, a file and a Map fail with
"Failed to create EDI message entity";
- the body after the send is the receipt with a synchronous MDN, and no
body without one or with an asynchronous one;
- server/listen gives the EDI message as text, or a stream with the base64
or binary transfer encoding;
- receipt/receive gives a `DispositionNotificationMultipartReportEntity`.
- **jdbc:**
- text, bytes, a stream and a file all run as SQL; a Map and a List are
sent as their toString(), which fails;
- a select gives a List of LinkedHashMap rows;
- SelectOne gives the Map, the value of a one-column row (a String, a
Long, a byte[] or a Blob), or null, and fails for two rows;
- StreamList gives a StreamListIterator; an update, an insert and DDL keep
the body.
- **smooks:** text, bytes, a stream and a file are read; a POJO (not wrapped
in a JavaSource), a Map, a List and no body fail. The output is the extracted
bean of a JavaSink, the bean Map without extract, the text of a StringSink, and
a stream of the input without exports.
- **vertx-http:**
- text, bytes, a stream, a file and no body are sent; a Map, a List, a
POJO, a number and a Path fail;
- the response is a byte[] whatever its size, and null for a 204.
- **tika:**
- text, bytes, a stream and a file are read; a Map, a List, a POJO and no
body fail;
- parse gives a ByteArrayOutputStream of XHTML, HTML or text; detect gives
the media type as a String.
- **snmp:**
- the poll and trap consumers give the XML text of the PDU;
- the trap producer sends a PDU body and keeps it, and a text body fails;
- the POLL producer gives an SnmpMessage, GET_NEXT a List of them.
- **pdf:**
- create and append write the body as text;
- extractText reads bytes, a stream or a file, but not the
ByteArrayOutputStream that create leaves (convert it to bytes first) and not
text;
- merge takes its files from a header.
- **file-watch:** the body is a java.io.File for CREATE, MODIFY and DELETE
events, and for directories too.
- **scp:** text, bytes, a stream and a file are stored; a Map, a List and a
POJO fail; no body fails unless allowNullBody=true.
- **graphql:**
- with the query option the body is not sent, except a camel-util-json
JsonObject, which is the variables;
- without it the body is the query;
- the response is a String, with GraphQL errors inside a 200 not failing
the exchange.
- **micrometer:** counters, summaries and timers keep the body, whatever it
is.
**Choices**
- The `ByteArrayOutputStream` that tika parse and pdf create, append and
merge leave is a `pojo` with that javaType, as with Azure's BinaryData before:
it is not text, bytes or a stream for the runtime, though it converts to them.
- as2 producerIn has an option value for `inBody=ediMessage`, a free-text
option (couchbase's operation in #28309 is one too): a step that sends the body
is checked, and one that takes the message from the header is not.
- graphql producerIn depends on query, queryFile and queryHeader: the body
is checked only when it is the query.
- vertx-http `responsePayloadAsByteArray` is also a component option, so it
is only in the description: naming it would make the output side unknown for
every step that leaves it out.
- spring-jdbc has the same body types as jdbc: its endpoint extends
JdbcEndpoint, and body types are not inherited.
**Docs fixed** (the prose about the body only):
- **jdbc:** the rows are LinkedHashMaps of a select; what SelectOne and
StreamList give; another statement keeps the body.
- **graphql:** the query comes from the body when no query option is set,
and only a camel-util-json JsonObject is the variables.
- **tika:** what the body is before and after detect and parse, and that
other types need their Tika parser module.
- **pdf:** convert the output of create to bytes before extractText.
- **smooks:** a POJO is read from a JavaSource body.
- **snmp:** what the POLL, GET_NEXT and TRAP producers give, and the XML
example without the declaration the code does not write.
**Measured.**
- The validator over the 1204 human-written and 1209 model-written route
files gives the same reports as with #28314.
- Body types now cover 97.5% of the endpoint uses in the human-written
routes (96.6% with #28314), and 139 of the 413 component JSONs have them.
**Tests**
- `TextBodyFlowTest.testTheBodyOfQueriesDocumentsAndFiles`:
- reported: a Map sent to jdbc, scp, vertx-http, tika parse, pdf create,
and graphql without a query option; a field read after graphql, tika detect,
pdf extractText, the as2 server and the snmp trap consumer;
- not reported: a Map sent to graphql with a query, and a field read after
jdbc, micrometer (the body is kept) and smooks.
- `CatalogDocsTest` uses ldif instead of jdbc as the component without body
types.
- These pass:
- the 293 tests of camel-yaml-dsl-validator;
- the 265 validator and catalog doc tests of camel-jbang-core;
- the builds of camel-yaml-dsl-maven-plugin and
camel-yaml-dsl-deserializers.
- The answers of camel_catalog_doc stay under 18 000 characters: vertx-http,
the largest, is 13 148.
_Claude Code on behalf of davsclaus_
🤖 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]