Hi andrew ...
Thanx for your response ...
Look the current configuration that i have ...
StateDAO: Is a bean than updates the "status" of mentioned flag, and gets the current state (1=Running, 0=Ready)
StateDAO.java:public String getState(String flag) throws SQLException {
try {
logger.debug("Flag: " + flag);
State response = (State) sqlMapClient.queryForObject("getState");
logger.info("State: " + response.getState());
return response.getState();
} catch (SQLException e) {
logger.error("Exception.", e);
throw e;
}
}
public Object updateState(State state) throws SQLException {
try {
sqlMapClient.update("updateState", state);
logger.info("state updated. " + state.getState());
return state;
} catch (SQLException e) {
logger.error("Exception.", e);
throw e;
}
}
--------------------------------------------------------------------------------------------------------
spring-beans.xml:<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="quartzEventSender" />
<property name="cronExpression" value="
0 0/1 7-22 * * ?" />
</bean>
<bean id="
StateDAO" class="com.flamingo.inventarios.dao.StateDAO">
<property name="sqlMapClient" ref="sqlMapState" />
</bean>
--------------------------------------------------------------------------------------------------------
mule-config.xml:
StateRunning: Transformer that returns an object of type State with state attribute = 1
StateReady: Transformer that returns an object of type State with state attribute = 0
<mule-descriptor name="TxProcessVerifier"
implementation="
StateDAO">
<inbound-router>
<endpoint address="
vm://txState" />
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.FilteringOutboundRouter">
<endpoint address="
vm://start" />
<filter className="org.mule.routing.filters.RegExFilter"
pattern="0">
<!-- ************ 0 is the "ready state" ************* -->
</filter>
</router>
</outbound-router>
</mule-descriptor>
<mule-descriptor name="startProcess"
implementation="org.mule.components.simple.PassThroughComponent">
<inbound-router>
<endpoint address=
"vm://start" transformers="Eamcscf1Key" />
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.MulticastingRouter">
<endpoint address="
vm://tlog" />
<!-- Changes the status to 1 (running) -->
<endpoint address="
vm://txState" transformers="
StateRunning" />
</router>
</outbound-router>
</mule-descriptor>
<mule-descriptor name="TlogSplitter"
implementation="org.mule.components.simple.PassThroughComponent">
<inbound-router>
<endpoint address="
vm://tlog" />
</inbound-router>
<outbound-router>
<router
className="com.lineai.paf.routing.outbound.tlog.TLOGFileMessageSplitter">
<endpoint address="
vm://tlogOutNullFilterVerifier"
synchronous="true" />
</router>
</outbound-router>
</mule-descriptor>
<mule-descriptor name="tlogOutNullFilterVerifier"
implementation="org.mule.components.simple.PassThroughComponent">
<inbound-router>
<endpoint address="
vm://tlogOutNullFilterVerifier" />
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.FilteringOutboundRouter">
<endpoint address="vm://tlog.out" />
<filter expectedType="com.lineai.smartmodule.recordset.SmartRecordSet"
className="org.mule.routing.filters.PayloadTypeFilter" />
</router>
<router className="org.mule.routing.outbound.FilteringOutboundRouter">
<endpoint address="
vm://txState" transformers="
StateReady" />
<filter className="com.lineai.paf.routing.filters.NullPayloadFilter" />
</router>
</outbound-router>
</mule-descriptor>
Ideas?
Thanks
On Tue, Oct 28, 2008 at 8:54 AM, Andrew Perepelytsya
<aperepel@...> wrote:
I think a different approach would work better. Have quartz fire every event on schedule, but let it send it to a custom component or filter which is going to check the database flag for you.
HTH,
Andrew
On Oct 28, 2008 9:34 AM, "David Borja" <adborja@...> wrote:
Hi mule users/devs ...
I have a splitter that splits a large file into little portions and these portions are procesed. This happens every minute (quartz provider).
However, if in a minute the large file is not processed completely, then the next quartz execution shouldn't start the flow.
I'm trying to do this, with some flag in a derby database: the initial state of this flag is "ready", when the process starts, then this flag is checked, if the flag has the "ready" state, then the process can continue, and changes its state to "running", when the flow finishes, then the flag state returns to "ready" state for next execution.
The problem is that i don't know when the flow finishes. My splitter returns "null" in method "getMessagePart" when there isn't portions anymore, and this causes the process stops. Is in this moment when i need to change the flag state to "ready", but how can i filter a "null" response from splitter?
Thanks!!