Skip to content

Commit 5b62707

Browse files
authored
Update message-history.adoc (#22498)
Proposed solution for users having their long messages truncated in the table.
1 parent 191db3c commit 5b62707

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

core/camel-core-engine/src/main/docs/modules/eips/pages/message-history.adoc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,34 @@ for (MessageHistory history : list) {
348348
System.out.println("Routed at id: " + history.getNode().getId());
349349
}
350350
----
351+
352+
== Configuring MessageHistory format
353+
354+
The Message History format in Camel is controlled by `Java String.format` patterns stored as global options on the CamelContext.
355+
356+
The defaults are defined in https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/MessageHelper.java[`MessageHelper.java`]:
357+
358+
[source,java]
359+
----
360+
private static final String MESSAGE_HISTORY_HEADER = "%-40s %-30s %-50s %-12s";
361+
private static final String MESSAGE_HISTORY_OUTPUT = "%-40.40s %-30.30s %-50.50s %12.12s";
362+
----
363+
364+
You can customize it using `application.properties`:
365+
366+
[source,properties]
367+
----
368+
camel.main.global-options[CamelMessageHistoryHeaderFormat] = %-40s %-30s %-120s %-12s
369+
camel.main.global-options[CamelMessageHistoryOutputFormat] = %-40.40s %-30.30s %-290.290s %12.12s
370+
----
371+
372+
If you want to configure the message format for a specific exchange, you can do it programmatically:
373+
374+
[source,java]
375+
----
376+
camelContext.getGlobalOptions().put(Exchange.MESSAGE_HISTORY_HEADER_FORMAT,
377+
"%-40s %-30s %-120s %-12s");
378+
379+
camelContext.getGlobalOptions().put(Exchange.MESSAGE_HISTORY_OUTPUT_FORMAT,
380+
"%-40.40s %-30.30s %-120.120s %12.12s");
381+
----

0 commit comments

Comments
 (0)