EzDev.org

Eureka

Elegant iOS form builder in Swift 2


How to designing a custom PickerInlineRow with Eureka

I am currently trying to use Eureka, a easy to use form generator for iOS in Swift.

Everything is going smooth, except one thing:

How to design a custom PickerinlineRow like in the example app at example/InlineRows/PickerInlineRow

The code used there is the following:

<<< PickerInlineRow<NSDate>("PickerInlineRow") { (row : PickerInlineRow<NSDate>) -> Void in

                    row.title = row.tag
                    row.displayValueFor = {
                        guard let date = $0 else{
                            return nil
                        }
                        let year = NSCalendar.currentCalendar().component(.Year, fromDate: date)
                        return "Year \(year)"
                    }

                    row.options = []
                    var date = NSDate()
                    for _ in 1...10{
                        row.options.append(date)
                        date = date.dateByAddingTimeInterval(60*60*24*365)
                    }
                    row.value = row.options[0]
                }

What I want to do is a same kind of InlinePicker but allowing the user to select 2 things: Month and Year. Problem is that I don't grasp the logic of the above piece of code, which var serve for what.

My current try are all totally not working.. If you have any idea.


Source: (StackOverflow)

Prana Side Car Service to Service Call

I am running into a strange problem. I have implemented a Prana Sidecar with a nodejs based service. The Node service uses prana host uri to locate and call another service. All of the services are in docker containers. It looks like I have to directly call the node service first in order to get prana to work. Otherwise I am getting the following error:

21:00:46.080 [http-nio-9003-exec-1] DEBUG o.s.c.n.zuul.web.ZuulHandlerMapping - Mapping [/sqlprana] to HandlerExecutionChain with handler [org.springframework.cloud.netflix.zuul.web.ZuulController@44cddafb] and 1 interceptor
21:00:46.106 [http-nio-9003-exec-1] INFO  o.s.c.n.z.filters.ProxyRouteLocator - Finding route for path: /sqlprana
21:00:46.106 [http-nio-9003-exec-1] DEBUG o.s.c.n.z.filters.ProxyRouteLocator - servletPath=/zuul
21:00:46.107 [http-nio-9003-exec-1] DEBUG o.s.c.n.z.filters.ProxyRouteLocator - path=/sqlprana
21:00:46.107 [http-nio-9003-exec-1] DEBUG o.s.c.n.z.filters.ProxyRouteLocator - Matching pattern:/sqlparser/**
21:00:46.108 [http-nio-9003-exec-1] WARN  o.s.c.n.z.f.pre.PreDecorationFilter - No route found for uri: /sqlprana

The problem does not happen if I directly hit the node service.


Source: (StackOverflow)

Unable to run Spring Cloud Config-Server in Eureka First Bootstrap mode

*****Config Server- Application Service Setup*****

  1. Below is the configuration from application.yml

    server:
      port: 8882
    eureka:
      client:
        serviceUrl:
          defaultZone: http://localhost:8761/eureka/
    spring:
      cloud:
        config:
          server:
             git:uri: https://github.com/appleman/config
    
  2. Below is the configuration from boostrap.yml

    spring:
      application:
        name: configserver
    
  3. Starting of this plain spring boot application registers config-server to Eureka.

**General Eureka Server is running on 8761 port

********Below is the Application Client configuration*****

  1. Below is the Application Client configuration in my bootstrap.yml

    spring:
      application:
        name: contractService,envDEV13 
      cloud:
        config:
        enabled: true
        discovery:
         enabled: true
         serviceId: configserver
    eureka:
      instance:
        nonSecurePort: ${server.port:8080}
      client:
        serviceUrl:
          defaultZone: http://${eureka.host:localhost}:${eureka.port:8761}/eureka/
    
  2. Injection of properties in Spring Controller like the below snippet is not working.

    @Value("${creditService.eppDbUrl}")
    String bar;
    

Please suggest us if we are doing anything wrong.


Source: (StackOverflow)

Swift Eureka form library - how do I customize a field after the form has rendered

I have a field that I would like to highlight after a validation error. From looking at the documentation I'm not sure where I would customize it after the field has already been initialized.


Source: (StackOverflow)

Eureka Performance - Any downside?

Netflix's information on the Server-client sync is as follows:

“Eureka clients fetches the registry information from the server and caches it locally. After that, the clients use that information to find other services. This information is updated periodically (every 30 seconds) by getting the delta updates between the last fetch cycle and the current one. The delta information is held longer (for about 3 mins) in the server, hence the delta fetches may return the same instances again. The Eureka client automatically handles the duplicate information.

After getting the deltas, Eureka client reconciles the information with the server by comparing the instance counts returned by the server and if the information does not match for some reason, the whole registry information is fetched again. Eureka server caches the compressed payload of the deltas, whole registry and also per application as well as the uncompressed information of the same. The payload also supports both JSON/XML formats. Eureka client gets the information in compressed JSON format using jersey apache client.”

In production what is the performance characteristic of this synch? It seems to me that the greater the number of clients i.e. services and instances of the services, the number of syncs would only slow the entire system down. Or is it a very minimal hit on the performance?


Source: (StackOverflow)

Setting up Eureka for non-AWS datacenter

I have setup Eureka with 2 peers. After about 5 minutes, I see this message appear in ui: EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.

When I look at the output from one of the running instances of Eureka, I see this:

2015-11-11 14:46:47.276  INFO 32748 --- [pool-5-thread-1] com.netflix.discovery.DiscoveryClient    : The response status is 200
2015-11-11 14:56:17.427  WARN 32748 --- [eerNodesUpdater] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry

If I'm understanding this correctly, Eureka thinks it is configured at AWS. I'm unable to find anything in the application.yml to indicate this.

server:
  port: 80

eureka:
  datacenter: boston
  instance:
    hostname: eureka03.domain.com
  client:
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
---
eureka:
  instance:
    hostname: eureka01.domain.com
  client:
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

Any ideas on what I'm missing in the config? Thanks.


Source: (StackOverflow)

Understanding Spring Cloud Eureka Server self preservation and renew threshold

I am new to developing microservices, although I have been researching about it for a while, reading both Spring's docs and Netflix's.

I have started a simple project available on Github. It is basically a Eureka server (Archimedes) and three Eureka client microservices (one public API and two private). Check github's readme for a detailed description.

The point is that when everything is running I would like that if one of the private microservices is killed, the Eureka server realizes and removes it from the registry.

I found this question on Stackoverflow, and the solution passes by using enableSelfPreservation:false in the Eureka Server config. Doing this after a while the killed service dissapears as expected.

However I can see the following message:

THE SELF PRESERVATION MODE IS TURNED OFF.THIS MAY NOT PROTECT INSTANCE EXPIRY IN CASE OF NETWORK/OTHER PROBLEMS.

1. What is the purpose of the self preservation? The doc states that with self preservation on "clients can get the instances that do not exist anymore". So when is it advisable to have it on/off?

Furthermore, when self preservation is on, you may get an outstanding message in the Eureka Server console warning:

EMERGENCY! EUREKA MAY BE INCORRECTLY CLAIMING INSTANCES ARE UP WHEN THEY'RE NOT. RENEWALS ARE LESSER THAN THRESHOLD AND HENCE THE INSTANCES ARE NOT BEING EXPIRED JUST TO BE SAFE.

Now, going on with the Spring Eureka Console.

Lease expiration enabled    true/false
Renews threshold    5
Renews (last min)   4

I have come across a weird behaviour of the threshold count: when I start the Eureka Server alone, the threshold is 1.

2. I have a single Eureka server and is configured with registerWithEureka: false to prevent it from registering on another server. Then, why does it show up in the threshold count?

3. For every client I start the threshold count increases by +2. I guess it is because they send 2 renew messages per min, am I right?

4. The Eureka server never sends a renew so the last min renews is always below the threshold. Is this normal?

renew threshold 5
rewnews last min: (client1) +2 + (client2) +2 -> 4

Server cfg:

server:
  port: ${PORT:8761}

eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  server:
    enableSelfPreservation: false
#   waitTimeInMsWhenSyncEmpty: 0

Client 1 cfg:

spring:
  application:
    name: random-image-microservice

server:
  port: 9999

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    healthcheck:
      enabled: true

Source: (StackOverflow)

How do I select one discovery service implementation if multiple are on the classpath?

I've added 1) a dependency on spring-cloud-starter-consul-discovery:1.0.0.M4 2) @EnableDiscoveryClient to my configuration and am now greeted with the following warning message on application startup:

More than one implementation of @EnableDiscoveryClient (now relying on @Conditionals to pick one): [org.springframework.cloud.consul.discovery.ConsulDiscoveryClientConfiguration, org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration]

This makes some sense since spring-cloud-starter-consul-discovery:1.0.0.M4 transitively depends spring-cloud-netflix-core:1.1.0.M2 but is a bit strange since I haven't explictly added a dependency on Eureka.

Looking at the @Conditionals for EurekaDiscoveryClientConfiguration it looks like it should not be loaded since EurekaClientConfig isn't on the classpath and setting eureka.client.enabled to false does not disable it either.

So… How do I select one discovery service implementation if multiple are on the classpath?


Source: (StackOverflow)

How to design a custom PickerInlineRow with Eureka

I am currently trying to use Eureka, a easy to use form generator for iOS in Swift.

Everything is going smooth, except one thing:

How to design a custom PickerinlineRow like in the example app at example/InlineRows/PickerInlineRow

The code used there is the following:

<<< PickerInlineRow<NSDate>("PickerInlineRow") { (row : PickerInlineRow<NSDate>) -> Void in

                row.title = row.tag
                row.displayValueFor = {
                    guard let date = $0 else{
                        return nil
                    }
                    let year = NSCalendar.currentCalendar().component(.Year, fromDate: date)
                    return "Year \(year)"
                }

                row.options = []
                var date = NSDate()
                for _ in 1...10{
                    row.options.append(date)
                    date = date.dateByAddingTimeInterval(60*60*24*365)
                }
                row.value = row.options[0]
            }

What I want to do is a same kind of InlinePicker but allowing the user to select 2 things: Month and Year. Problem is that I don't grasp the logic of the above piece of code, which var serve for what.

My current try are all totally not working.. If you have any idea.

PS. I know this question was already asked here, but as there is not really an answer to it and I am not allowed to ask for more help there, I am forced to repost the exact same question here.


Source: (StackOverflow)