Вопрос

I have a mule flow :- I have the following flow :-

<context:property-placeholder location="classpath:conf/DBConnectionProp.properties"/>
<spring:beans>
<spring:bean id="DB_Source" name="DB_Source" class="org.enhydra.jdbc.standard.StandardDataSource">
<spring:property name="url" value="${url}"/>
<spring:property name="driverName" value="${driverName}"/>
</spring:bean>
<spring:bean id="LookUp" name="LookUp" class="com.vertu.services.schema.maindata.v1.Dao.MainDataDAOImpl">
<spring:property name="dataSource" ref="DB_Source"/>
</spring:bean>

<spring:bean id="objectStore" class="org.mule.util.store.SimpleMemoryObjectStore"/>
</spring:beans>


<jdbc-ee:connector name="Database_Global" dataSource-ref="DB_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<reconnect frequency="1000" count="3" />
<jdbc-ee:query key="InsertQuery" value="INSERT INTO getData(ID,NAME,AGE,DESIGNATION)VALUES(?,?,?,?)"/>
<jdbc-ee:query key="RetriveQuery" value="Select * from getData where ID=?"/>
<jdbc-ee:query key="CheckRowExistsQuery" value="Select count(*) from getData where ID=?"/>
<jdbc-ee:query key="UpdateQuery" value="UPDATE getData SET NAME=?, AGE=?, DESIGNATION = ? WHERE ID=?"/>
<jdbc-ee:query key="DeleteQuery" value="DELETE FROM getData WHERE ID=?"/>
</jdbc-ee:connector>

<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>

<flow name="db_exceptionsFlow" doc:name="db_exceptionsFlow" >
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" path="mainData" doc:name="HTTP"/>
<cxf:jaxws-service serviceClass="com.test.services.schema.maindata.v1.MainData" doc:name="SOAP"/>

<until-successful objectStore-ref="objectStore" maxRetries="5" secondsBetweenRetries="10" doc:name="Until Successful">
<component class="com.test.services.schema.maindata.v1.Impl.MainDataImpl" doc:name="JavaMain_ServiceImpl"/> 
</until-successful>

<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<logger message="Response :- #[message.payload]" level="INFO" doc:name="Logger"/>

<catch-exception-strategy doc:name="Catch Exception Strategy">
<jms:outbound-endpoint queue="errorQueue" connector-ref="Active_MQ" doc:name="JMS"/>
</catch-exception-strategy>
</flow>

<!-- <flow name="db_retryFlow" doc:name="db_retryFlow" >
<jms:inbound-endpoint connector-ref="Active_MQ" address="jms://tcp:errorQueue" doc:name="JMS" exchange-pattern="request-response"/>

<logger level="INFO" message="message :-#[message.payload]" doc:name="Logger"/>
</flow> --> 
</mule>

But now the issue is:-

It is creating errorQueue but no message message is there in the queue when DB server is not available..

Since it is a web service I have put the implement class (com.test.services.schema.maindata.v1.Impl.MainDataImpl) which is responsible for DB operation under until successful

One more issue is incase of success (when DB endpoint is available) it is not showing any response in SOAPUI

Please help... so that I can put the message in ActiveMQ whenever DB endpoint is not available and can retrieve the message from ActiveMQ whenever DB endpoint is available again and use the message for DB interaction ....

Это было полезно?

Решение

The until-successful router is an asynchronous one, i.e. elements after it will execute right away and exceptions happening inside of it will not be propagated outside of it.

To solve your problem, configure a deadLetterQueue endpoint on it so that failed messages end up sent to errorQueue.

Read more about until-successful in the user guide: http://www.mulesoft.org/documentation/display/current/Until+Successful+Scope

Другие советы

So, the final solution as per David's suggestion is put object to string transformer before jms outbound in catch exception block and now the message is in the queue and is working for me

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top