These are chat archives for spring-cloud/spring-cloud

13th
Sep 2016
Spencer Gibb
@spencergibb
Sep 13 2016 00:07
You have to create one and use the annotation mentioned now.
Josh Long
@joshlong
Sep 13 2016 04:23
hi! :D i'm talking to some folks who say thhat when a context is refreshed, the @RefreshScope s applied to the creation of the CloudEurekaClient and it loses all the cached routes and statistics. is ther e away to make this less all-or-nothing
Dave Syer
@dsyer
Sep 13 2016 06:11
You could probably create your own instance of the client
The reason it's in refresh scope by default is to pick up changes in its own configuration (which might not be all that important for some people)
David Steiman
@xetys
Sep 13 2016 10:05
I am currently looking how to setup eureka server in a quite aggressive mode, where the shutdown of services is recognized as early as possible...my production server runs spring cloud application in docker containers, which when killed, keep deadly hanging in eureka for about 2 minutens approx.
i was trying to switch preservation mode, renewal timeout and evict intervall, but not noticed some greater changes\
what is the propper way of configuring it in a aggressive mode?
eureka.server.evictionIntervalTimerInMs has worked for some
but eureka favors availability over consistency. You may look at consul if you need consistency.
bitsofinfo
@bitsofinfo
Sep 13 2016 20:29
Seeing at org.springframework.cloud.stream.converter.JsonToPojoMessageConverter.convertFromInternal barf on deserializing a interface. Where can I register the type converter for spring cloud stream? I already have a custom jackson SimpleModule @Bean in the context, but that apparently is not being consulted
this is for a @StreamListener responding to a message payload w/ application/json
bitsofinfo
@bitsofinfo
Sep 13 2016 21:36
This message was deleted

So i did this

    @Bean
    public List<AbstractFromMessageConverter> customMessageConverters() {

        ObjectMapper mapper = new ObjectMapper();
        SimpleModule module = new SimpleModule();
        module.setAbstractTypes(new SimpleAbstractTypeResolver().addMapping(MyInterface.class, MyImpl.class));
        mapper.registerModule(module);

        ArrayList<AbstractFromMessageConverter> mine = new ArrayList<AbstractFromMessageConverter>();
        mine.add(new MyConverter(mapper));
        return mine;
    }

Which is great, as I can see in the debugger that these converters are registered in the CompositeMessageConverterFactory

Problem is, that JsonToPojoMessageConverter is still used and I can't get around this exception (it never has a chance to get to my converter)

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of MyInterface.class

I have no idea how to get that ObjectMapper that JsonToPojoMessageConverter to be mine, or if that is even what I need to do

bitsofinfo
@bitsofinfo
Sep 13 2016 22:12
Ok, got it working, but not sure if this is still the recommended way.