[keycloak-user] admin-client hang

Marek Posolda mposolda at redhat.com
Wed Apr 18 03:21:57 EDT 2018


On 17/04/18 21:28, Nhut Thai Le wrote:
> Hello,
>
> I'm writing a script to automate our realm setup using keycloak
> admin-client. I use the same client for multiple calls and at some point,
> my script hang. Is there any issue with using the same client for multiple
> calls?
It's not an issue, but make sure that:
- You use connection pooling. By default, it's 10 connections. See 
source of classes Keycloak and KeycloakBuilder
- Make sure you close responses. Especially for the "create" methods, 
which returns Response objects, you need to explicitly close them. For 
the methods, which returns void or JSON objects, you don't need to do 
anything

If needed, see our testsuite for more inspirations. It's using 
adminClient in almost all the tests.

> Is each public method of the admin-client asynchronous? If yes, how
> do I chain calls like: create realm-> create client -> create resource ->
> create permissions -> create policy,...
No, calls are synchronous and chaining shouldn't be an issue.

Marek
>
> Thai
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user




More information about the keycloak-user mailing list