2017-10-30 11 views
0

私は顧客の名前を返す安心のサービスを持っており、asycn呼び出しを行って顧客リストの名前を取得したいと思います。ループ内のJava非同期の残りの呼び出し

だから私は、顧客やリストコール一つずつ作りを反復curretnlyイムのリストを持っている:

public List<Participant> retieveParticipantsFullName(List<Participant> participantList) throws GeneralException{ 


    for (Participant participant : participantList) { 
     String fullRetrievePartFullURL = retrieveParticipantsFullNameUrl+participant.getCustomerType()+"/"+participant.getCustomerID(); 
     ResponseEntity<RetrieveCustomerNameResponse> resultResp ; 

      resultResp = restTemplate.getForEntity(fullRetrievePartFullURL, 
        RetrieveCustomerNameResponse.class); 
      participant.setCustomerMiddlename(resultResp.getBody().getCustomerNameOut().getCustomerMiddlename()); 


    } 

    return participantList; 

は、それがで実行できるように非同期な方法でこの呼び出しをする方法はありますパラオ? よろしく

答えて

1

おかげではい、代わりRestTemplateを使用して、あなたはListenableFuture秒を返す、AsyncRestTemplateを使用する必要があります。

関連する問題