How to update after calling dispatchEvent

View: New views
2 Messages — Rating Filter:   Alert me  

How to update after calling dispatchEvent

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using Mule 2.0.1 version:

After passing the request to outbound asynchronous jms endpoint using the static recipient list router, I want to update a table if there are no exceptions in  outbound. I am not sure where to  keep the logic of updating the table.
I wrote the component and logic as given below. But the problem is,  dispatch event is running in a new thread and
the table is getting updated even if there are any exceptions in the outbound.

And I don’t want to keep the update table logic in outbound transformers as I want to update only if the outbound send message is completed  without any exceptions.

Any thoughts where to keep the update logic?  


Config:
     
   <!-- Multiple endpoints (Some with same queue addres with different transformers -) ->
       
        <jms:endpoint name="destination1" address="jms://QUEUE1" />
                <transformers>    
                        <transformer ref="destination1Transformer"/>            
                </transformers>
        </jms:endpoint>
     
        <jms:endpoint name="destination2" address="jms://QUEUE1" />
                <transformers>    
                        <transformer ref="destination2Transformer"/>            
                </transformers>
        </jms:endpoint>

        <jms:endpoint name="destination3" address="jms://QUEUE2"/>
                <transformers>    
                        <transformer ref="destination3Transformer"/>            
                </transformers>
         </jms:endpoint>

        <jms:endpoint name="destination4" address="jms://QUEUE2"/>
                <transformers>    
                        <transformer ref="destination4Transformer"/>            
                </transformers>
         </jms:endpoint>

        <-- Multiple static endpoints -->


    <!-- Service -->
    <service name="Service1">              
        <inbound>        
                <jms:inbound-endpoint queue="READQUEUE">
                        <transformers>
                                <transformer ref="jMSMessageToObject"/>  
                                <transformer ref="appTransform"/>    
                        </transformers>              
                </jms:inbound-endpoint>
        </inbound>
             
        <component>    
                <singleton-object class="com.test.services.TestServiceComponent">
            </singleton-object>
                <custom-lifecycle-adapter-factory class="com.xxxx.LifecycleAdapterFactory"/>
        </component>  
         
        <outbound>
                <static-recipient-list-router></static-recipient-list-router>
        </outbound>
             
    </service>


TestServiceComponent:


        public void process(Request req) throws SQLException,MuleException {
               
                       
                MuleMessage message = RequestContext.getEventContext().getMessage();    
                ArrayList<String> recipients = new ArrayList<String>();                
                recipients.add(req.getDestinationURL());   // req.getDestiantionUrl gives any one of the global endpint  
                                                                                             //names like "destinaton1",""destinaton2","destinaton3" etc.
                message.setProperty("recipients", recipients);
               
                //Disptaching the event to static recipient list outbound router
                RequestContext.getEventContext().dispatchEvent(message);
               
                //updating the table
                AppJdbcUtil.insert(req);
               
        }

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: How to update after calling dispatchEvent

by Marco Mascia-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello gurus .. can you suggest anything to resolve the issue i have mentioned?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email