Giter Club home page Giter Club logo

Comments (9)

ivarconr avatar ivarconr commented on May 27, 2024

Hi, we just released a new Subscriber API, which will make it much easier to debug this.

Would you mind upgrading your unleash-client-java to version 3.2.2?

With the new version you can register a custom UnleashSubscriber to log out what the unleash-client is actually doing internally:

UnleashConfig unleashConfig = new UnleashConfig.Builder()
	.appName("java-test")
	.instanceId("instance y")
	.unleashAPI("https://unleash.herokuapp.com/api/")
	.subscriber(new UnleashSubscriber() {
	    @Override
	    public void onReady(UnleashReady ready) {
		System.out.println("Unleash is ready");
	    }

	    @Override
	    public void togglesFetched(FeatureToggleResponse toggleResponse) {
		System.out.println("Fetch toggles with status: " + toggleResponse.getStatus());
	    }

	    @Override
	    public void togglesBackedUp(ToggleCollection toggleCollection) {
		System.out.println("Backup stored.");
	    }

	    @Override
	    public void toggleBackupRestored(ToggleCollection toggleCollection) {
		System.out.println("Backup read.");
	    }

	})
	.build();

Unleash unleash = new DefaultUnleash(unleashConfig);

When the client behaves as expected you should get something like this:

Backup read.
Fetch toggles with status: CHANGED
Backup stored.
Unleash is ready
Fetch toggles with status: NOT_CHANGED
Fetch toggles with status: NOT_CHANGED
....

And when a toggle is changing status in the UI / server you should see:

....
Fetch toggles with status: NOT_CHANGED
Fetch toggles with status: CHANGED
Backup stored.
Fetch toggles with status: NOT_CHANGED
....

With the custom Subscriber above, what is your output i the console?

from unleash-client-java.

vkatoch2000 avatar vkatoch2000 commented on May 27, 2024

2019-02-26 10:21:59.202 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Backup read.
10:21:59.202 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Backup read.
2019-02-26 10:21:59.895 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Fetch toggles with status: CHANGED
10:21:59.895 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: CHANGED
2019-02-26 10:21:59.900 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Backup stored.
10:21:59.900 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Backup stored.
2019-02-26 10:21:59.904 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Unleash is ready
10:21:59.904 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Unleash is ready

19-02-26 10:22:59.605 INFO 1652 --- [sh-api-executor] c.w..config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:22:59.605 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:24:05.733 INFO 1652 --- [sh-api-executor] c.w..config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:24:05.733 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:24:59.617 INFO 1652 --- [sh-api-executor] c.w..config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:24:59.617 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:26:00.718 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:26:00.718 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:27:05.745 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:27:05.745 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:27:59.881 INFO 1652 --- [sh-api-executor] c.w.submgn.config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:27:59.881 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:28:59.702 INFO 1652 --- [sh-api-executor] c.w..config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:28:59.702 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
2019-02-26 10:29:59.706 INFO 1652 --- [sh-api-executor] c.w..config.WebConfigurer : Fetch toggles with status: UNAVAILABLE
10:29:59.706 [INFO ] [no_tenant ] c.w.s.config.WebConfigurer - Fetch toggles with status: UNAVAILABLE
First request working 200 but
status code 400 is coming later on

UnleashConfig unleashConfig = UnleashConfig.builder()
.appName("XYZ")
.instanceId(UUID.randomUUID().toString())
.fetchTogglesInterval(60)
.disableMetrics()
.unleashAPI("http://localhost:"+env.getProperty("server.port")+"/api")
.subscriber(new UnleashSubscriber() {
@OverRide
public void onReady(UnleashReady ready) {
log.info("Unleash is ready");
}

            @Override
            public void togglesFetched(FeatureToggleResponse toggleResponse) {
                log.info("Fetch toggles with status: " + toggleResponse.getStatus());
            }

            @Override
            public void togglesBackedUp(ToggleCollection toggleCollection) {
                log.info("Backup stored.");
            }

            @Override
            public void toggleBackupRestored(ToggleCollection toggleCollection) {
                log.info("Backup read.");
            }

        })
        .build();

return new DefaultUnleash(unleashConfig);

Client version 3.2.2 as suggested

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

This is super wired!

Can you also override the onError method on the subscriber and log out the full error message.

Could you inspect the logs of unleash-server also?

400 response typically implies that the server is not happy with the request.

I know multiple companies using the java client in production without issues (even my company, across 50+ java apps). I hope we can sort this out!

from unleash-client-java.

vkatoch2000 avatar vkatoch2000 commented on May 27, 2024

The problem is why it is working first time while taking backup , starts giving issues later
Do we have two end points in back end to fetch features data from server ?

from unleash-client-java.

vkatoch2000 avatar vkatoch2000 commented on May 27, 2024

when accessing my instance over AWS load balancer I would always get: HTTP/1.1 400 BAD_REQUEST.
Here are some findings given by someone i think this could be issue :
an empty header (no name and no value) because I had an empty row in HTTP Header Manager in jMeter. So, I persume, AWS ELB does some headers checking, and returns HTTP 400, even tough I wasn't having any problems with going with the same request to my instances directly. I don't know if this will help you but you should

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

This surprises me a lot. The initial request does indeed have an empty header, the If-None-Match header is bootstrapped with an empty string.

This has been fixed in 3ea27de and released as 3.2.3. I really hope this solves your issue.

Thanks for reporting, debugging help and your patience. 👍 🎉 🥇

from unleash-client-java.

vkatoch2000 avatar vkatoch2000 commented on May 27, 2024

it works , we can close this, t hanks for fixing this issue so fast......

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

...should probably add a null check also before closing.

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

adressed in #72

from unleash-client-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.