use of org.springframework.cloud.stream.messaging.DirectWithAttributesChannel in project spring-cloud-stream by spring-cloud.
the class StreamBridge method afterSingletonsInstantiated.
@Override
public void afterSingletonsInstantiated() {
if (this.initialized) {
return;
}
FunctionRegistration<Function<Object, Object>> fr = new FunctionRegistration<>(v -> v, STREAM_BRIDGE_FUNC_NAME);
fr.getProperties().put("singleton", "false");
Type functionType = ResolvableType.forClassWithGenerics(Function.class, Object.class, Object.class).getType();
this.functionRegistry.register(fr.type(functionType));
Map<String, DirectWithAttributesChannel> channels = applicationContext.getBeansOfType(DirectWithAttributesChannel.class);
for (Entry<String, DirectWithAttributesChannel> channelEntry : channels.entrySet()) {
if (channelEntry.getValue().getAttribute("type").equals("output")) {
this.channelCache.put(channelEntry.getKey(), channelEntry.getValue());
}
}
this.initialized = true;
}
Aggregations