Configuration Properties
pipelite-spring-starter has no application.properties/application.yml-based configuration
today. A plain @Bean returning a ChannelConfigurer is not picked up automatically - nothing
in pipelite-spring-starter scans for that type. Every adapter setting shared across a context (an
HTTP server’s port, Kafka’s bootstrap servers, a file adapter’s state directory) is registered
explicitly, from a bean implementing PipeliteContextInitializer, which the autoconfiguration
does detect and invoke for you once the context exists (see
Autoconfiguration):
import io.pipelite.core.context.PipeliteContext;
import io.pipelite.spring.context.PipeliteContextInitializer;
@Component
public class ChannelAdapterConfiguration implements PipeliteContextInitializer {
@Override
public void initializeContext(PipeliteContext context) {
context.addChannelConfigurer((HttpChannelConfigurer) configuration -> {
configuration.setPort(8443);
configuration.setHost("127.0.0.1");
configuration.setMaxEntitySize(1024 * 1024); // bytes
});
}
}
Register as many addChannelConfigurer(…) calls as needed - one per adapter type - inside the
same initializeContext(…) method, or across several PipeliteContextInitializer beans; every
one of them runs before the context starts.
Per-source settings (a Kafka groupId, an HTTP method restriction) are set per
fromSource(…) call instead, not through a configurer at all - see each adapter’s own
Channel Adapters page for its typed SourceConfigurer.
HTTP
context.addChannelConfigurer((HttpChannelConfigurer) configuration -> {
configuration.setPort(8443);
configuration.setHost("127.0.0.1");
configuration.setMaxEntitySize(1024 * 1024); // bytes
});
See HTTP Channel Adapter for the full list of settings and their defaults.
Kafka
context.addChannelConfigurer((KafkaChannelConfigurer) configuration -> {
configuration.setBootstrapServers("kafka-broker:9092");
configuration.setGroupId("my-app-group");
configuration.setAutoOffsetReset("earliest");
});
See Kafka Channel Adapter for the full list of settings and their defaults.
File
context.addChannelConfigurer((FileChannelConfigurer) configuration -> {
configuration.setStateDirectory(Path.of("/var/lib/myapp/pipelite-file-state"));
configuration.setAllowedWriteDirectory(Path.of("/var/lib/myapp/outbox"));
});
See File Channel Adapter for the full list of settings, including
registering a custom FileRecordMapper.
Only the first ChannelConfigurer registered for a given adapter type is applied;
calling addChannelConfigurer more than once for the same adapter has no effect beyond the first.
Fold every setting for one adapter into a single call.
|