Looking for doc and example for the cf-java-client lib

550 views
Skip to first unread message

Dominique Vernier

unread,
Jan 25, 2014, 7:30:13 AM1/25/14
to vcap...@cloudfoundry.org
Hi,

I started to use the cf-java-client lib but the number of examples and documentation seems to be very limited or I didn't find it.
Could somebody point me to:

1) Samples, blogs and wiki explaning how to use the cf-java-client lib.
2) JavaDoc
3) Community where to find information and exchange information except of this one.

Many Thanks
Dominique

James Bayer

unread,
Jan 25, 2014, 7:22:38 PM1/25/14
to vcap...@cloudfoundry.org
this is the right place for questions. this tests typically are good examples [1]. if you're familiar with the cf command line client, then i would expect the CloudFoundryClient interface [2] to be straight-forward to understand.


To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.



--
Thank you,

James Bayer

Dominique Vernier

unread,
Jan 26, 2014, 1:43:07 AM1/26/14
to vcap...@cloudfoundry.org
Thx James, you right it is useful.

I would like to find out how I can check that an application is fully operational (wait).
I tried with this:
            AppState state;
            do {
                CloudApplication app = client.getApplication(appName);
                state = app.getState();
                System.out.println("State:" + state);
                Thread.sleep(5000);
            } while (!AppState.STARTED.equals(state));
but the state because STARTED before the app can be used.
Shall I go to the staging logs using getStagingLogs() and wait until I have an exception meaning the staging phase is fully finished?
or there is another method to test that?

Many Thanks
Dominique

James Bayer

unread,
Jan 26, 2014, 2:44:32 AM1/26/14
to vcap...@cloudfoundry.org

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.

Dominique Vernier

unread,
Jan 27, 2014, 2:12:53 AM1/27/14
to vcap...@cloudfoundry.org
Thx, it works but you need also to call CloudApplication.getApplication(name) in order to have the latest number of instances.

Scott Frederick

unread,
Jan 27, 2014, 10:11:43 AM1/27/14
to vcap...@cloudfoundry.org
The Cloud Foundry Maven plugin[1] serves as a good sample of how to interact with cf-java-client. The most useful code is in the package containing the implementations of the goals[2]. 

For an idea of how to monitor that an application operational, see [3]. This code waits for at least one instance of the app to return a "running" status. 

Scott

Ben Hale

unread,
Jan 27, 2014, 12:32:15 PM1/27/14
to vcap...@cloudfoundry.org
We also work extensively with the Java client in the Java Buildpack System Tests.  We skip asking the Cloud Foundry API when an application is ready, opting instead to hit the application itself.


-Ben Hale
Cloud Foundry Java Experience
Reply all
Reply to author
Forward
0 new messages