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

14th
Jun 2018
Anders Engström
@andersenleo
Jun 14 2018 04:54
@marcosbarbero yeah, that’s sad. It feels like the service-locator feature of Ribbon isn’t really a first-class construct (and that it didn’t make it into the spring-cloud wrapper).
Are there any other spring-cloud ready alternative for client-side load-balancing (I haven’t found any).
Gilles Robert
@ask4gilles
Jun 14 2018 06:43

Hi, I'm using spring-cloud-consul-core-1.3.1.RELEASE.
I'm facing an issue related to transactions management: I'm using a SimpleMessageListenerContainer configured with a StatefulRetryOperationsInterceptor.

 @Bean
  public StatefulRetryOperationsInterceptor retryInterceptor() {
    StatefulRetryOperationsInterceptorFactoryBean factoryBean = new StatefulRetryOperationsInterceptorFactoryBean();
    factoryBean.setRetryOperations(retryTemplate());
    factoryBean.setMessageRecoverer(new RejectAndDontRequeueRecoverer());
    return factoryBean.getObject();
  }

My adviceChain is as follow:

container.setAdviceChain(retryInterceptor, transactionInterceptor);

When I receive a message which needs to be treated inside a transaction, I encounter the following exception:
Caused by: org.springframework.transaction.IllegalTransactionStateException: No existing transaction found for transaction marked with propagation 'mandatory'

The ConsulAutoConfiguration defines this bean:

@Bean(name = "consulRetryInterceptor")
        @ConditionalOnMissingBean(name = "consulRetryInterceptor")
        public RetryOperationsInterceptor consulRetryInterceptor(
                RetryProperties properties) {
            return RetryInterceptorBuilder
                    .stateless()
                    .backOffOptions(properties.getInitialInterval(),
                            properties.getMultiplier(), properties.getMaxInterval())
                    .maxAttempts(properties.getMaxAttempts()).build();
        }

The javadoc of the RetryOperationsInterceptor mentions:

 * Hint about transaction boundaries. If you want to retry a failed transaction you need
 * to make sure that the transaction boundary is inside the retry, otherwise the
 * successful attempt will roll back with the whole transaction. If the method being
 * intercepted is also transactional, then use the ordering hints in the advice
 * declarations to ensure that this one is before the transaction interceptor in the
 * advice chain.

(If I disable Consul, everything works fine)

How should I configure my advicechain so that this retry bean created by ConsulAutoConfiguration is in the correct order related to tx?

puneeth kumar reddy
@puneethmr1_twitter
Jun 14 2018 12:18
I have a spring 4 application and would like to make use of spring cloud as a dependency without autoconfiguration. can I do that?
Marcos Barbero
@marcosbarbero
Jun 14 2018 12:28
Spring Cloud is built on top of spring-boot, meaning that it uses a lot of autoconfig, however, from self experience, you can make it work in a non-boot app
what exactly you wanna do @puneethmr1_twitter ?
Jose Armesto
@fiunchinho
Jun 14 2018 13:15
using spring cloud kubernetes adds the kubernetes profile when running on kubernetes, but this profile doesn't do anything by itself, it's just so we can add Beans that we want to enable only when running on kubernetes, right?
I'm asking because we were using k8s for that, so I'm thinking about renaming it to kubernetes, but I was afraid that would enable/change something unexpected
puneeth kumar reddy
@puneethmr1_twitter
Jun 14 2018 13:19
@marcosbarbero I wanna use spring cloud sleuth in my non-boot app to introduce tracing of requests
ghoddg
@ghoddg
Jun 14 2018 13:38
Hi, I have implemented my services which include the config server, service discovery, api-gateway using zuul(want to move to spring-cloud-gateway) and some applications using spring boot 1.5.12 and spring cloud Edgware SR2. Now I want to upgrade those all applications to latest spring boot and spring cloud. Can anyone suggest the versions I should upgrade ?
Marcin Grzejszczak
@marcingrzejszczak
Jun 14 2018 13:38

I have a spring 4 application and would like to make use of spring cloud as a dependency without autoconfiguration. can I do that?

@puneethmr1_twitter why don’t you just want to upgrade to boot?

puneeth kumar reddy
@puneethmr1_twitter
Jun 14 2018 13:43
@marcingrzejszczak I have lot of services that are non boot. upgrading them will be a huge effort. so looking for a work around.
Marcin Grzejszczak
@marcingrzejszczak
Jun 14 2018 13:44
I'm pretty sure that you'll invest more time in the workaround
Guilherme Blanco
@guilhermeblanco
Jun 14 2018 14:50
Hi! Is it possible to remove the Application created as part of spring-cloud-stream-schema-server? It prevents my Application to boot, it also overlays my bootstrap.yml configuration with the package-provided application.yml (and rewrites my server.port, application name, etc) preventing me to get it properly working in my Kubernetes cluster. Github path: https://github.com/spring-cloud/spring-cloud-stream/tree/master/spring-cloud-stream-schema-server/src/main/java/org/springframework/cloud/stream/schema/server
Guilherme Blanco
@guilhermeblanco
Jun 14 2018 14:58
GH issue: spring-cloud/spring-cloud-stream#1391
Francesco Fazzini
@ffazzini
Jun 14 2018 16:37
@ryanjbaxter i just replied with a reproducer https://github.com/spring-cloud/spring-cloud-netflix/issues/2946#issuecomment-396981926 please let me know if you prefer to chat on gitter instead ;) thank you!
Anders Engström
@andersenleo
Jun 14 2018 19:34
Maybe this #3009 is an old and worn-out issue? It feels like it should be a pretty clean enhancement, but I’m probably missing something..