kabul ettiğimizde yük artar:Bahar DİNLENME şablon biz Spring'in DİNLENME şablonu için günlükleri bu tür görmeye başlamak, bizim DİNLENME hizmetlerden biri bazı yük testi sırasında başlıklarını
eşzamanlı yük altındave 3-4 saat sonra, http isteğinin kabul başlık RestTemplate DİNLENME hizmeti çağrıldığını
aşağıdaki giriş olarak bir string kabul eder ve sahip 400 Hata (Bad Request) başarısız başlatın kullanarak bu hizmete
DEBUG: org.springframework.web.client.RestTemplate - Setting request Accept header to [text/plain, application/json, application/*+json, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain, text/plain,<and so on>, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, */*, <and so on>]
Sonunda tüm çağrıları olur imza
@RequestMapping(value = "/findRecordById", method = {RequestMethod.POST, RequestMethod.GET })
@ResponseBody
public String findRecordById(@RequestBody String id) {//method body}
Biz Ör "SomeID" formunun istek içeriği ile bu servise taleplerin POST türünü gönderiyor "123"
Hafif yük altında, servisi aramada sorun yoktur.
Kafa karıştırıcı, REST şablonunun kabul başlıklarının listesine eklenmeye devam eden text/plain, */*. Bu neden oluyor?
DİNLENME şablon fasulye beyanı şu şekildedir:
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
<constructor-arg>
<bean class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
<property name="readTimeout">
<value>90000</value>
</property>
<property name="httpClient" ref="restHttpClient" />
</bean>
</constructor-arg>
</bean>
<bean id="restHttpClient" class="org.apache.http.impl.client.DefaultHttpClient">
<constructor-arg>
<bean class="org.apache.http.impl.conn.PoolingClientConnectionManager">
<property name="defaultMaxPerRoute">
<value>100000</value>
</property>
<property name="maxTotal">
<value>100000</value>
</property>
</bean>
</constructor-arg>
</bean>
istek oluşturulurken nasıl
String postParams = "\"" + id + "\"";
String postResp = restTemplate.postForObject("findRecordById",postParams, String.class);
bize 'RestTemplate' ile yapmak bir isteğin bir örnek gösterin lütfen .. –
nasıl bir göstermek için soru Düzenlendi istek yapıldı –
Yani 'restTemplate' doğrudan 'ApplicationContext' üzerinden ekstra bir değişiklik yapmadan? Ve yukarıdaki gibi tonlarca talep gönderir misin? –