One Star

tRESTClient response when destination URL is not reachable

How to handle the scenario where endpoint URL is down and what component can we used to raise a customize response ?
4 REPLIES
Community Manager

Re: tRESTClient response when destination URL is not reachable

Hi 
You can use 'onsubjoberror' connector after tRestClient to fire a tSendMain to send an email or tFixedFlowInput to customize response and log them to somewhere. For example:
tRestClient
   |
onsubjoberror
   |
tFixedFlowInput--main--tLogRow
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tRESTClient response when destination URL is not reachable

I am getting below exceptions from tRestClient,how can i handle this scenerio to give customer a customize response.
Error:-
{https:// (URL)}tRESTClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
    at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
    at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:633)
    at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1042)
    at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:857)
    at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:831)
    at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:394)
    at org.apache.cxf.jaxrs.client.WebClient.post(WebClient.java:420)
    at ebs_integrations.eb_autnetgw_token_1_4.eb_AutNetGW_token.tRESTRequest_1_LoopProcess(eb_AutNetGW_token.java:15329)
    at ebs_integrations.eb_autnetgw_token_1_4.eb_AutNetGW_token$RestServiceProviderImpl4TalendJob.processRequest(eb_AutNetGW_token.java:1553)
    at ebs_integrations.eb_autnetgw_token_1_4.eb_AutNetGW_token$RestServiceProviderImpl4TalendJob.getToken(eb_AutNetGW_token.java:1702)
    at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57)
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:447)
    at
Community Manager

Re: tRESTClient response when destination URL is not reachable

Hi
You can use a tLogCatcher to catch the exception message and customize the message.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tRESTClient response when destination URL is not reachable

I am unable to resolve my issue with TlogCatcher.
My Testcase is i have a trestclient which call some service based on the URL defined now what i want is when am not able to get any response from the URL(Server) due due to some server problem or host not reachable ,after certain timeout limit of trestclient it start giving exceptions, now what i want is if i don't receive service from the server or destination host is not reachable,i should be able to provide customize response to customer that there is some technical problem going on at server side please try again later.