This version is still in development and is not considered stable yet.

Exchange

The Exchange is the fundamental vehicle through which data travels along a flow. Each time a source produces an event, a new Exchange is created and passed through all nodes in the pipeline.

Payload access

// Read the incoming payload
Object raw = exchange.getInputPayload();
MyDto dto  = exchange.getInputPayloadAs(MyDto.class);

// Check the payload type
Class<?> type = exchange.getInputPayloadType();

// Set the output payload
exchange.setOutputPayload(result);

Headers

Headers are string key-value pairs shared across all nodes in the flow. The methods below are shortcuts to exchange.getHeaders(), which returns the underlying Headers when you need it (the expression engine uses it to resolve Headers['name']).

// Write
exchange.putHeader("correlation-id", "abc123");

// Safe read
Optional<String> id = exchange.tryGetHeader("correlation-id");

// Read with expectation (throws exception if absent)
String id = exchange.expectHeader("correlation-id");

// Typed read
Optional<Integer> count = exchange.tryGetHeaderAs("retry-count", Integer.class);

// Removal
exchange.removeHeader("temp-header");