call subflow with in mule3 webservice

前端 未结 2 576
傲寒
傲寒 2020-12-18 16:15

I created a Mule3 Simple Front-end Web Service which is supposed to pass the XML message to a sub-flow and returns success to its caller.

mule-config.xml


2条回答
  •  被撕碎了的回忆
    2020-12-18 16:28

    I solved this problem by using singleton instance to store requestMessage with in test() method of WebserviceTestImpl class and retrieve it in TestSubflow component. I am not sure if it is perfect. but it works:)

    Here is how I did it..

    mule-config:


    
      
      
      
      
    
    
    
        
            
        
    
    

    WebserviceTestImpl and TestSubflow code snippet


    public class WebserviceTestImpl implements WebserviceTest,Serializable {
        private static final long serialVersionUID = 1L;
        private TestMessageProxy testMessageProxy;
    
        public TriggerTestImpl() {
            this.testMessageProxy = TestMessageProxy.getInstance();
        }
        @Override
        public String test(String requestMessage) throws Exception{
            this.testMessageProxy.setTestMessage(requestMessage);
            return "success";
        }
    }
    
    public class TestSubflow  implements Callable{
        private TestMessageProxy testMessageProxy;
        public TestSubflow() {
            this.testMessageProxy = TestMessageProxy.getInstance();
        }
    
        @Override
        public Object onCall(MuleEventContext context) throws Exception {
            String  testMessage = this.testMessageProxy.getTestMessage();
        }
    }
    

提交回复
热议问题