insaneyogi
insaneyogi

Reputation: 231

Mule: DB Insert fails with timeout

I am trying to insert data into the database table & I am getting the following error:

Exception stack is: 1. Timeout exceeded (java.util.concurrent.TimeoutException) com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider:426 (null) 2. Error sending HTTP request. Message payload is of type: String (org.mule.api.MessagingException) org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)


Root Exception stack trace: java.util.concurrent.TimeoutException: Timeout exceeded at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider.timeout(GrizzlyAsyncHttpProvider.java:426) at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$3.onTimeout(GrizzlyAsyncHttpProvider.java:274) at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:398) at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:377) at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)


My Insert code is as follows:

     <flow name="api-main">
   <http:listener config-ref="db-system-api-httpListenerConfig" path="/api/*" doc:name="HTTP"/>
    <apikit:router config-ref="db-system-api-config" doc:name="APIkit Router"/>
    <exception-strategy ref="db-system-api-apiKitGlobalExceptionMapping" doc:name="Reference Exception Strategy"/>
    </flow>

    <flow name="put:/contract/{id}:db-system-api-config" processingStrategy="synchronous" >
    <set-property propertyName="Content-Type" value="application/json" doc:name="Set Content Type"/>
    <logger message="#[payload]" level="INFO" doc:name="Initial Payload"/>

    <json:json-to-object-transformer returnClass="java.util.HashMap" mimeType="text/plain" doc:name="JSON to Object"/>


        <foreach collection="#[payload.entrySet()]" doc:name="For Each">
        <db:insert config-ref="Oracle_Configuration" doc:name="Database">
        <db:parameterized-query><![CDATA[INSERT INTO XX.XX_OE_HDR (ID,
                                                                               NUMBER,
                                                                                EFF_START_DATE,
                                                                                EFF_END_DATE,   
                                                                                CUST_NUMBER) 
                                                                                VALUES (xx.XX_HDR_SEQ.NEXTVAL,   
                                                                                        xx.XX_HDR_NUM_SEQ.NEXTVAL,
                                                                                       TO_DATE('2017-05-23','YYYY-MM-DD HH24:MI:SS'),
                                                                                       TO_DATE('2017-06-23','YYYY-MM-DD HH24:MI:SS'),
                                                                                        #[payload.myField])]]></db:parameterized-query>
         </db:insert>
         </foreach>
        <logger message="Record successful" level="INFO" doc:name="Log Success"/>

Upvotes: 0

Views: 476

Answers (1)

mario martinez
mario martinez

Reputation: 297

according to Timeout exceeded at com.ning.http.client your issue is located in the http request. As far as I know, Oracle Database ( as most of the common databases) use TCP protocol for transport while your issue is located in an http timeout.

Can you provide the full flow and also how are you triggering the flow?

On the other hand, can you try to isolate the issue and replace the Database for a logger and check if there is no problem with your http request to the flow ? (assuming you are triggering this flow via http request)

Upvotes: 0

Related Questions