Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 12:22
    marcingrzejszczak commented #1537
  • 12:20
    asgarj commented #1537
  • 11:55
    marcingrzejszczak commented #1537
  • 11:27
    spring-issuemaster unlabeled #1537
  • 11:27
    spring-issuemaster labeled #1537
  • 11:26
    asgarj commented #1537
  • 10:48
    marcingrzejszczak labeled #1537
  • 10:48
    marcingrzejszczak unlabeled #1537
  • 10:34
    marcingrzejszczak commented #1537
  • 10:32
    asgarj commented #1537
  • 10:01
    spring-issuemaster labeled #677
  • 10:01
    eacdy opened #677
  • 09:36
    spring-issuemaster labeled #676
  • 09:34
    eacdy opened #676
  • 07:39

    spring-buildmaster on gh-pages

    Sync docs from 2.1.x to gh-pages (compare)

  • 06:59
    codecov[bot] commented #1546
  • 06:59
    codecov[bot] commented #1546
  • 06:56
    codecov[bot] commented #1546
  • 06:56
    codecov[bot] commented #1546
  • 06:56
    codecov[bot] commented #1546
murali474
@murali474
@MOES-Media , Thank you for responding.
I have two different backend services , i want to route them using spring cloud gateway and i want to maintain routes configuration in seperate yaml files like first-service.yaml and second-service.yaml
in my gateway project
Jeroen Nouws
@MOES-Media

IF I remember correctly (I'm at a client rn so can't look it up) we've accomplished this with including spring-profiles in our parent yml file like so:

spring:
    profiles:
        include:
            - foo-service
            - bar-service

then we added application-foo-service.yml and application-bar-service.yml, we didn't use this on our gateway, but rather to load some domain properties, however the concept is the same so I think this will also work in the gateway (again not 100% sure since I can't test it rn) the reason we did it like this is because the yaml spec doesn't define anything like import or include

murali474
@murali474
@MOES-Media Thank you , will try
Jeroen Nouws
@MOES-Media
@murali474 Good luck and let me know if it works ;)
murali474
@murali474
sure
it worked sucessfully @MOES-Media thank you once again
Jeroen Nouws
@MOES-Media
glad I was able to help, now go write some code XD
Alper Kanat
@tunix
Hi! I'm trying to add custom metadata to EurekaInstanceConfigBean after it's initialized by Spring's EurekaClientAutoConfiguration. I'm injecting EurekaInstanceConfigBean in a constructor and adding metadata into it while assuming it'll get sent to the Eureka Server. I'm guessing that this is not guaranteed and the updated metadata map may not get sent to Eureka Server. Since the registration to Eureka Server is achieved by a netflix class, I'm guessing that my only option is to use ApplicationInfoManager, is that correct? And if I use that class, it may not get sent while the initial registration but with the subsequent updates, am I right?
Sudarshan
@SudBisht
@OlgaMaciaszek is there a way in SCG to return response from cache instead of downstream microservice
like in Zuul you can stop forwarding request with:
ctx.setSendZuulResponse(false);
Tyler Van Gorder
@tkvangorder
@tunix We have our own auto-configuration that does this. It looks something like this:
@Configuration
@ConditionalOnClass(EurekaClientConfig.class)
@AutoConfigureBefore(EurekaClientAutoConfiguration.class)
public class EurekaAutoConfiguration implements BuildCloudConstants {
.
.
.
    @Bean
    @org.springframework.cloud.context.config.annotation.RefreshScope
    @Primary
    public EurekaInstanceConfigBean eurekaInstanceConfiguration(InetUtils inetUtils) {
        EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils);
        instance.setNonSecurePort(this.nonSecurePort);
        //This method adds additional meta-data to be pushed out to Eureka when the instance registers.
        Map<String, String> metaData = instance.getMetadataMap();

        metaData.put(METADATA_VERSION_KEY, applicationVersion);
        metaData.put(METADATA_ENVIRONMENT_KEY, environment);
        metaData.put(METADATA_ZONE_KEY, primaryZone);
        metaData.put(METADATA_SECONDARY_ZONE_KEY, secondaryZone);

        .
        .
        .
        return instance;
    }
jeff-lauterbach-jdas
@jeff-lauterbach-jdas
I'm working with spring-cloud-gateway and wondering if its possible to create Global Filters to rewrite request/response bodies.
Spencer Gibb
@spencergibb
yes, if they are modeled off of the existing route filters. Reminder, your gateway becomes memory constrained.
Mohamed A
@blueoceandevops
I am using SseEmitter in a microservice. now problem is when i scale up a instance new microservice instance didnt have SseEmitter list object.. i can't save this into redis also (due serialization issue).. please help to solve it ?
Spencer Gibb
@spencergibb
@blueoceandevops what is SseEmitter?
Mohamed A
@blueoceandevops
org.springframework.web.servlet.mvc.method.annotation.SseEmitter - class
Olga Maciaszek-Sharma
@OlgaMaciaszek
@SudBisht AFAIR we do not offer such possibility and I don't think we were planning on adding it, but if you create a GH issue describing the enhancement and the usage scenarios where you need it, we will discuss it in the team and see what can be done
Mauro Pinto
@crybat
Hi! Is it possible to have a self configured config server with a redis backend a la https://cloud.spring.io/spring-cloud-config/reference/html/#_embedding_the_config_server ? I've tried some various configurations, without much success. Thanks
Jeroen Nouws
@MOES-Media
what do you mean? do you mean a spring-boot application with an embedded config server that has a connection to redis for x reasons? or do you want a config server with a redis backend that contains your config?
Mauro Pinto
@crybat
I have a stand alone config server and I want it to consume some properties from redis itself. This server needs to publish itself to our discovery cluster. The discovery cluster urls are defined in redis. The client - server config is working fine.
The server itself is already serving the properties fine, is what I mean. But I'm not sure how to make it read its own properties.
eureka:
  # make production
  environment: prod
  client:
    enabled: true
#    enabled: false
    serviceUrl:
      # discovery peers urls from param-store
      defaultZone: ${eureka-cluster-urls} # <- should come from redis
Jeroen Nouws
@MOES-Media
have you tried it with an EnvironmentPostProcessor?
in your META-INF folder create a file called spring.factories with following property
org.springframework.boot.env.EnvironmentPostProcessor=foo.bar.MyCustomEnvironmentPostProcessor
your 'MyCustomPostProcessor' is a class that implements the EnvironmentPostProcessor interface
it has a method `public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application)
in which you can put your custom logic to load the properties from your redis store and set them on your ConfigurableEnvironment
Jeroen Nouws
@MOES-Media
more info can be found in this post from Baeldung
just make sure you're setting the properties before the DiscoverClient tries to register itself with eureka
kevcherrington
@kevcherrington
What is the best way to reduce the number of requests from my Spring Cloud Config servers to my git server? Is it by setting spring.cloud.config.server.git.refreshRate? Our Bitbucket (git) server is receiving more requests than it can handle and the OPS team suspects its the config servers.
Spencer Gibb
@spencergibb
@kevcherrington likely turning off the health indicator
kevcherrington
@kevcherrington
Thanks I'll look into that.
Anbu Sampath
@anbusampath
I guess Spring cloud project page need to update to Hoxton SR1 GA, still showing Hoxton RELEASE. https://spring.io/projects/spring-cloud#learn
Spencer Gibb
@spencergibb
done
ktechmidas
@ktechmidas
Hey guys! Trying to figure out how to format the secrets for spring-cloud-starter-aws-secrets-manager-config, it seems it needs secret-app so if I was to use secret.com.example.text and import the module would it automatically populate the secrets or is there more config to do?
basically can't figure out how to format the name (of the secret and the secretmanager) or get it into the app....
ktechmidas
@ktechmidas
So now for some reason it's pulling 'null' in from somewhere...
com.amazonaws.services.secretsmanager.model.AWSSecretsManagerException: User: arn:aws:iam::917258326408:user/xxx is not authorized to perform: secretsmanager:GetSecretValue on resource: arn:aws:secretsmanager:ap-southeast-1:917258326408:secret:/secret/null_dev-GzYzyj (Service: AWSSecretsManager; Status Code: 400; Error Code: AccessDeniedException; Request ID: xxx)
ktechmidas
@ktechmidas
Ah alright set the spring app name, but now I'm unsure about the suffix... GzYzyj in this case
Martin Maier-Moessner
@tine2k
Hi guys, I am using Spring Cloud Gateway (Hoxton.SR1 on SB2.2.2 and Java11.0.3). I am running into a problem where under high load some requests fail because the required route can not be found. I suspect this is related to rebuilding the route cache. This rebuild happens periodically because I use it together with Spring Cloud Config (correct?). I can reproduce this error by rebuilding the route cache manually via actuator. My questions (I guess probably best for @spencergibb) are:
1) Is the rebuilding the route cache designed and implemented to be an atomic operation?
2) Can I disable the cache rebuilding and still distribute my routes via Spring Cloud Config?
Thanks!
Spencer Gibb
@spencergibb
@tine2k file an issue?
Martin Maier-Moessner
@tine2k
Mauro Pinto
@crybat
@MOES-Media Sorry for only answering now. This is somewhat what I ended up with: https://gist.github.com/crybat/5b23e4bc227037492d40f6826a37d668 . Thanks
Sheerie
@Sheerie
This message was deleted

I recently replaced Hystrix with resilience4j with spring cloud. Most of the unit test are working fine but now I am getting 504 gateway timeout after 1 second. Is there anyway, I can configure the timeout in the properties? So far, I have added

@Bean
public Customizer<ReactiveResilience4JCircuitBreakerFactory> defaultCustomizer() {
    return factory -> factory.configureDefault(id -> new Resilience4JConfigBuilder(id)
            .circuitBreakerConfig(CircuitBreakerConfig.custom()
                    .minimumNumberOfCalls(5).failureRateThreshold(20)
                    .build())
            .timeLimiterConfig(TimeLimiterConfig.custom().timeoutDuration(Duration.ofSeconds(10))
                    .build())
            .build());
}

And also set the properties in application.yml file

spring:
cloud:
config:
enabled: false
gateway:
httpclient:
response-timeout: 6s
connect-timeout: 6000
Is there any other timeout, I need to configure?

Here are spring cloud dependencies

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RELEASE</version>
</dependency>

and resilience4j
<resilience4j.version>1.1.0</resilience4j.version>

Sheerie
@Sheerie
@ryanjbaxter @spencergibb
Ryan Baxter
@ryanjbaxter
do u have a stacktrace?
Nicolas Widart
@nWidart

Hello, I'm having issues setting up CORS configuration in a spring cloud gateway app. I've set the following config to allow everything from everything:

spring:
  cloud:
    gateway:
      globalcors:
        corsConfigurations:
          '[/**]':
            allowedOrigins: "*"
            allowedMethods: "*"

Yet, when im calling an endpoint to the gateway I'm getting:

OPTIONS http://localhost:8080/api/spot/spots 403 (Forbidden)
localhost/:1 Access to XMLHttpRequest at 'http://localhost:8080/api/spot/spots' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

When I call one of the services by-passing the gateway the requests goes through fine.
Any ideas what I'm missing? Thanks.