Hey @marc
Thanks for the food for thought :-)! I managed to reach my goal:
@Bean
public MyObjectPublisher myObject() {
return new MyObjectPublisher();
}
public class MyObjectPublisher implements Supplier<MyObject> {
private BlockingDeque<MyObject> myObjects = new LinkedBlockingDeque<>();
@Override
public MyObject get() {
return myObjects.poll();
}
public void publish(MyObject personWithHeight) {
myObjects.add(personWithHeight);
}
}
spring.cloud.function.definition= myObject
spring.cloud.stream.bindings.myObject-out-0.destination = xy
For publishing I inject the MyObjectPublisher into mycode and call publish…
The problem with the approach: It seems to take forever until a message is published.