Question

I`ve made a software using mule that logs what it is doing (rounting a WS) into a database but if the db is down it doenst go up and the log only says the connection is refused, after puting the db server up it works just fine, is there any option or way to configure my mule software so it can restart and work fine even if the db is down, since its optional not requered for the procedure?

code:

<jdbc:postgresql-data-source name="WSA" user="${database.user}" password="${database.pass}" url="${database.url}" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source"> </jdbc:postgresql-data-source>

<jdbc:connector name="jdbcConnector" dataSource-ref="WSA" validateConnections="false" queryTimeout="10" pollingFrequency="10000" doc:name="Database"> 
    <jdbc:query key="wsadb" value="insert into inbound_messages (payload, timestamp, agent, ip_from, endpoint, soap_operation) values ('', now(), #[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()], '');"></jdbc:query>  
</jdbc:connector>

<flow name="log-request" doc:name="log-request">
    <vm:inbound-endpoint path="log-request.in" doc:name="VM"></vm:inbound-endpoint>  
    <logger message="#[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()]" level="INFO" doc:name="Logger"></logger>  
    <jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="wsadb" responseTimeout="10000" queryTimeout="10" connector-ref="jdbcConnector" doc:name="Persist raw message"></jdbc:outbound-endpoint>
</flow>
Was it helpful?

Solution

You would need a reconnection strategy in your JDBC connector and set it to blocking="false": http://www.mulesoft.org/documentation/display/current/Configuring+Reconnection+Strategies

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top