Hey @Mike13,
Hmm…I’m just passing through with a few minutes so I haven’t compiled this, but something like this should work:
@Bean
public Supplier<Message<String>> mySupplier() {
return () -> {
String payload = "whatever";
String myTopic = useYourBusinessLogic();
logger.info("Publishing to: " + myTopic);
return MessageBuilder.withPayload(payload).setHeader(BinderHeaders.TARGET_DESTINATION, myTopic).build();
};
}