Closed smithtonson closed 6 years ago
You don't have to subclass the main config file.
You can add @Bean methods that return a DataObjectConverter
@SpringBootApplication
@EnableSseEventBus
public class TestDefaultConfiguration implements SseEventBusConfigurer {
@Override
public Duration clientExpiration() {
return Duration.ofSeconds(10);
}
@Bean
public DataObjectConverter testObject2Converter() {
return new DataObjectConverter() {
@Override
public boolean supports(SseEvent event) {
return event.data() instanceof TestObject2;
}
@Override
public String convert(SseEvent event) {
TestObject2 to = (TestObject2) event.data();
return to.getId() + "," + to.getCustomer();
}
};
}
}
Ah, gotcha; that's working for me. Thanks
The
SseEventBusConfigurer
doesn't have support for adding object converters, so I have to subclass the main config file but that's a problem due to private members