Working example on Spring Mediator in WSO2 ESB 4.6.0

后端 未结 4 1952
情话喂你
情话喂你 2021-01-16 11:24

Hi i am working on Spring Mediator in WSO2 ESB 4.6.0, using this and this tutorial

I am getting the Error as follows:

ERROR - SpringMediator Cannot l         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-16 12:07

    I got to work this as below,

    The class should extends AbstractMediator and override the mediate() method as follows,

    package com.test.spring.mediator.workingexampleonspringmediator;
    
    import org.apache.synapse.MessageContext;
    import org.apache.synapse.mediators.AbstractMediator;
    
    public class HelloWorld extends AbstractMediator{
    
               private String message;   
           public void setMessage(String message){
              this.message  = message;
           }
    
           public boolean mediate(MessageContext arg0) {
    
              System.out.println("HELLO "+message);
              return true;
        }
    }
    

    Then place the jar in [ESBHOME]/repository/components/lib folder

    In mediate method it prints a message with the argument like HELLO 'arg'

    And I added the following file to registry (/_system/config/repository/spring/springtest.xml),

    
     
         
       
       ISURU
       
    
    

    My proxy is as follows,

    
       
          
             
                
             
             
             
                
             
          
       
       
    
    

    In the proxy you can see the bean=[bean id of the springtest.xml] and class=qualified name of the class

    In my ESB terminal, I got the following out put with the given property value in springtest.xml,

    [2013-11-07 17:38:30,654]  INFO - LogMediator To: /services/testSpring.testSpringHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:bcae82e9-4027-43c5-bd7a-cbfa885aaf33, Direction: request, START = __________________________, Envelope: 
    HELLO ISURU
    [2013-11-07 17:38:30,692]  INFO - LogMediator To: /services/testSpring.testSpringHttpSoap12Endpoint, WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: urn:uuid:bcae82e9-4027-43c5-bd7a-cbfa885aaf33, Direction: request, END = ______________________, Envelope: 
    

    You must restart the ESB after placing the jar in repository/components/lib

提交回复
热议问题