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

3rd
Jul 2018
James McShane
@jmcshane
Jul 03 2018 03:13 UTC
I have a use case that I'm not sure if spring-cloud could solve through a streaming method, here's what I'm looking to do. I want to build an application that gets credentials to a Kubernetes cluster and streams events that come through the watch endpoint, such as on the event object. This endpoint keeps alive the connection and continues to stream events as JSON documents separated by newlines. Is there a way to tie in an open HTTP connection with a stream structure in spring-cloud?
Enrico Hofmann
@gigo1980_gitlab
Jul 03 2018 08:39 UTC
hi is anyone using spring contract with openfeign inside a spring boot 2 app ?
Jason Yarn
@GreedyPirate
Jul 03 2018 08:47 UTC
hi, @spencergibb , is there a way to make a unit test to prove @Bean ServerList created?
Dominik
@kaidowei
Jul 03 2018 08:55 UTC
@spencergibb I found a problem with this PR ( spring-cloud-incubator/spring-cloud-kubernetes#154 ) should I open a new bug or update the feature/bug request that is already open ( spring-cloud-incubator/spring-cloud-kubernetes#150 ) ?
Problem is, that the heartbeat events publish a list of services, which rarely changes in contrast to consul or eureka, which publish increasing int/long values
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:10 UTC
@GreedyPirate you can do something like this:
  @Autowired
    private ApplicationContext context;

    @Test
    public void testBeanCreation() {
        ServerList serverList = this.context.getBean(ServerList.class);
      notNull(serverList);
    }
Jason Yarn
@GreedyPirate
Jul 03 2018 09:18 UTC
@marcosbarbero I did this once, test failed , then I user ApplicationContextRunner
private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
            .withConfiguration(AutoConfigurations.of(RibbonEurekaAutoConfiguration.class));


    @Test
    public void testLoadBean(){
        this.contextRunner.run(context -> {
            assertThat(context).hasSingleBean(ServerList.class);
        });
    }
also failed
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:22 UTC
it should work with my example above, if it failed because the Bean returned null it basically means it’s not being created
Jason Yarn
@GreedyPirate
Jul 03 2018 09:23 UTC
yes, it will be created at the first service call
i found it by debug
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:24 UTC
is it a lazy bean?
Jason Yarn
@GreedyPirate
Jul 03 2018 09:24 UTC
maybe , i am not sure
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:24 UTC
how are you creating it?
Jason Yarn
@GreedyPirate
Jul 03 2018 09:27 UTC
emmm...
I custom a RibbonClient ServerList,and it worked, however, test failed
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:31 UTC
well, without knowing how (in code level) you are creating this bean it’s kinda difficult to tell whether it’s a lazy bean or not
is it a autoconfig class? what’s your approach?
Jason Yarn
@GreedyPirate
Jul 03 2018 09:34 UTC
ok, here is my code
@Configuration
@ConditionalOnClass(Ribbon.class)
public class RibbonConfig {
    public static final int DEFAULT_CONNECT_TIMEOUT = 1000;
    public static final int DEFAULT_READ_TIMEOUT = 2000;

    public static final String NAMESPACE = "qconf.url";
    @RibbonClientName
    private String name = "client";

    @Bean
    @ConditionalOnMissingBean
    public IClientConfig ribbonClientConfig() {
        DefaultClientConfigImpl config = new DefaultClientConfigImpl();
        config.loadProperties(this.name);
        config.set(CommonClientConfigKey.ConnectTimeout, DEFAULT_CONNECT_TIMEOUT);
        config.set(CommonClientConfigKey.ReadTimeout, DEFAULT_READ_TIMEOUT);
        return config;
    }


    @ConditionalOnProperty(value = "frame.qconf.enabled", matchIfMissing = true)
    @Bean
    public ServerList<Server> ribbonServerList(Environment environment, PropertiesFactory propertiesFactory, IClientConfig config) {
        if (propertiesFactory.isSet(ServerList.class, name)) {
            return propertiesFactory.get(ServerList.class, config, name);
        }
        String qconfUrl = getQconfUrl(environment, name);
        if (StringUtils.isEmpty(qconfUrl)) {
            ConfigurationBasedServerList serverList = new ConfigurationBasedServerList();
            serverList.initWithNiwsConfig(config);
            return serverList;
        }
        return new QconfBasedServerList(qconfUrl, config);
    }
}
@RibbonClients(defaultConfiguration = RibbonConfig.class)
public class GlobalRibbonConfig {

}
@Configuration
@ConditionalOnClass(Feign.class)
@Import({GlobalRibbonConfig.class})
public class EarthFeignAutoConfiguration {}
and config it in spring.factories
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:37 UTC
so, you are creating an auto-config, right?
Jason Yarn
@GreedyPirate
Jul 03 2018 09:39 UTC
yep
Marcos Barbero
@marcosbarbero
Jul 03 2018 09:51 UTC
sure
so you may use the ApplicationContextRunner to test it instead
Jason Yarn
@GreedyPirate
Jul 03 2018 09:52 UTC
yes, this is one of my tests
chetz3
@chetz3
Jul 03 2018 09:59 UTC
@spencergibb both my service is https .. trying to route using gateway i am getting
Tue Jul 03 15:25:48 IST 2018 There was an unexpected error (type=Internal Server Error, status=500). SSLEngine closed already
Marcos Barbero
@marcosbarbero
Jul 03 2018 10:59 UTC
do you have it in a open repo @GreedyPirate ?
Jason Yarn
@GreedyPirate
Jul 03 2018 11:00 UTC
no
Marcos Barbero
@marcosbarbero
Jul 03 2018 11:00 UTC
can it be?
Jason Yarn
@GreedyPirate
Jul 03 2018 11:00 UTC
you can also custome a RibbonClient, and test
sry, i can not
Enrico Hofmann
@gigo1980_gitlab
Jul 03 2018 11:40 UTC
has anyone used spring cloud contractwith embedded oauth ?
so spring security
Marcin Grzejszczak
@marcingrzejszczak
Jul 03 2018 16:07 UTC
I have - what seems to be the problem?
KaijuDeluxe
@KaijuDeluxe
Jul 03 2018 16:17 UTC
hi when i am building my spring project by mvn install, it is only 28KB big, so the depenedies are missing. Any one an idea what could be the problem?
Marcos Barbero
@marcosbarbero
Jul 03 2018 17:33 UTC
are you using maven? do you have the spring-boot-maven-plugin in it?
KaijuDeluxe
@KaijuDeluxe
Jul 03 2018 17:34 UTC
hi yes this one was missing -.- thank you
Guilherme Blanco
@guilhermeblanco
Jul 03 2018 17:40 UTC
Hi! I’ve reported last week about spring-cloud-stream 2.0 having issues publishing and receiving DTOs (json encoding/decoding). I’ve created a repository with 2 commits to show my failure scenario: first one with basics, working as intended. Second commit adds a complex DTO to be exchanged, and now it fails.
1- Working example: guilhermeblanco/spring-cloud-stream-demo@b8231a1
2- Breaking changes: guilhermeblanco/spring-cloud-stream-demo@5d3d641
If you discard the models, there’s no actual new small blocks of code besides these files:
The message that exists inside of RabbitMQ is shown here:
Screen Shot 2018-07-02 at 11.22.55 PM 1.png
Marcos Barbero
@marcosbarbero
Jul 03 2018 17:42 UTC
@guilhermeblanco there’s a room for spring-cloud-stream, it probably suits better for you
Guilherme Blanco
@guilhermeblanco
Jul 03 2018 17:43 UTC
@marcosbarbero ok, thanks! =)
Enrico Hofmann
@gigo1980_gitlab
Jul 03 2018 18:09 UTC
Hi together, i have read that it is possible that we can create from SpringWebTest AsciiDoc and also grovy file for the contract. is the other way from the contract also possible. to run the test and generate the rest documentation?
KaijuDeluxe
@KaijuDeluxe
Jul 03 2018 19:21 UTC
which ways are you guys installing services? i install them on ubuntu using systemd. Is this the usual way or is there another, easier way to organize all services?