davsclaus commented on code in PR #25495:
URL: https://github.com/apache/camel/pull/25495#discussion_r3917740208
##########
core/camel-api/src/main/java/org/apache/camel/spi/CamelEvent.java:
##########
@@ -94,6 +96,22 @@ enum Type {
void setTimestamp(long timestamp);
+ /**
+ * Dumps the full event as a pretty-printed JSON string.
+ *
+ * @param indent number of spaces to indent
+ * @return JSON representation of this event
+ * @since 4.23
+ */
+ String toJSon(int indent);
+
+ /**
+ * The full event as a {@link Map} suitable for JSON serialization,
containing structured metadata for this event.
+ *
+ * @since 4.23
+ */
+ Map<String, Object> asJSon();
Review Comment:
`CamelEvent` is a published SPI, and these two methods are added as
**non-`default`** abstract methods. That's a source- and binary-incompatible
change for any code outside Camel that implements `CamelEvent` (or one of its
sub-interfaces) directly — it will no longer compile/link.
`project-standards.md` requires maintaining backwards compatibility for public
APIs.
All in-tree events extend the modified abstract base classes, so the
internal build is fine — the risk is entirely external.
Suggest making both methods `default` so existing implementers keep working.
Since `CamelEventJsonSupport` lives in `camel-base` (not reachable from
`camel-api`), a reasonable default is a minimal map here (e.g.
`type`/`timestamp`/`message`), with the rich implementation remaining the
override in
`AbstractContextEvent`/`AbstractExchangeEvent`/`AbstractRouteEvent`/etc. If a
hard SPI break is genuinely intended, it needs explicit justification and an
upgrade-guide entry.
--
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]