[ 
https://issues.apache.org/jira/browse/HTTPASYNC-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16270035#comment-16270035
 ] 

Muzeeb commented on HTTPASYNC-129:
----------------------------------

Hi Gary,

Here is the code snippet which is working correctly in windows but not in 
oracle linux server. 
Please let me know if you need any other details.

public void invokePostAPIMethodsAsychronously(List<ClientAPI> clientAPIs) 
throws Exception {
                logger.debug("Entering invokePostAPIMethodsAsychronously()");
                try {
                        RequestConfig requestConfig = 
RequestConfig.custom().setSocketTimeout(3000).setConnectTimeout(3000).build();
                        CloseableHttpAsyncClient httpClient = 
HttpAsyncClients.custom()
                            .setDefaultRequestConfig(requestConfig)
                            .setMaxConnPerRoute(1000)
                            .setMaxConnTotal(1000)
                            .build();
                httpClient.start();
               
                clientAPIs.stream().parallel().forEach( clientAPI -> {
                        
                        HttpPost postRequest = new 
HttpPost(clientAPI.getEndPoint());
                        
                        logger.info("The post call is 
"+clientAPI.getEndPoint());
                        
                        if(clientAPI.getBasicAuthUserName() !=null && 
clientAPI.getBasciAuthPassword() !=null) {
                                Header authHeader =new 
BasicHeader(Constants.JSON_REQUEST_HEADER_AUTHORIZATION_STRING, 
                                                
Constants.JSON_REQUEST_HEADER_BASIC_STRING+ 
                                 
getAuthString(clientAPI.getBasicAuthUserName(),clientAPI.getBasciAuthPassword()));
                                postRequest.addHeader(authHeader);
                        }
                        if(clientAPI.getHeaderParamKey() !=null && 
clientAPI.getHeaderParamValue() !=null) {
                                Header customHeader =new 
BasicHeader(clientAPI.getHeaderParamKey(),clientAPI.getHeaderParamValue());
                                postRequest.addHeader(customHeader);
                        }
                        
                        StringEntity  requestEntity = new 
StringEntity(clientAPI.getJsonRequest(), ContentType.APPLICATION_JSON);
                        postRequest.setEntity(requestEntity);                   
                                
                        logger.info("The post json request is 
"+clientAPI.getJsonRequest());

                    httpClient.execute(postRequest, new 
FutureCallback<HttpResponse>() {

                    public void completed(final HttpResponse response) {
                        logger.info(postRequest.getRequestLine() + "->" + 
response.getStatusLine());
                    }

                    public void failed(final Exception ex) {
                        logger.info(postRequest.getRequestLine() + "->" + ex);
                    }

                    public void cancelled() {
                        logger.info(postRequest.getRequestLine() + " 
cancelled");
                    }

                });
                });
                       
                httpClient.close();  
                } catch(Exception e){
                        logger.error(e.getMessage());
                        throw e;
                }
                logger.debug("Exiting invokePostAPIMethodsAsychronously()");
        }

> CloseableHttpAsyncClient is not working in Oracle Enterprise Linux Server
> -------------------------------------------------------------------------
>
>                 Key: HTTPASYNC-129
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-129
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.3
>         Environment: Oracle Enterprise Linux Server
>            Reporter: Muzeeb
>
> Hi Apache Team,
> It appears that CloseableHttpAsyncClient object is not invoking any rest API 
> calls in oracle linux server. same application is working as expected in 
> windows server.
> Please find our application details below.
> Application Type: Spring Boot Microservice
> JDK: 1.8.
> HttpAsyncClient: 4.1.3
> Please let me know if you need any details to troubleshoot this issue.
> Regards
> Muzeeb



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to