Wso2 如何在另一个中介类内调用类中介属性值

Wso2 如何在另一个中介类内调用类中介属性值,wso2,wso2esb,Wso2,Wso2esb,我需要调用另一个中介类中的某个类中介属性值 这是我的SurepayMediator课程 package esb.cellcard.billing; public class SurepayMediator extends AbstractMediator{ public boolean mediate(MessageContext context) { context.setProperty("firstValue", "Run Fast"); if(

我需要调用另一个中介类中的某个类中介属性值

这是我的SurepayMediator课程

package esb.cellcard.billing;    
public class SurepayMediator extends AbstractMediator{
    public boolean mediate(MessageContext context) { 
      context.setProperty("firstValue", "Run Fast");

      if(something){
          //Here I need to execute AddSubscription class 
      }
      else {
         //Here I need to execute CancleSubscription class 
      }
      return true;
   }
}
我需要在AddSubscription类和CancelSubscription类中调用此firstValue

添加订阅

package esb.cellcard.billing;

public class AddSubscription extends AbstractMediator{

SurepayMediator sm = new SurepayMediator();

public boolean mediate(MessageContext context) { 
    //I need to call that firstValue in here
    return true;
  }
}
package esb.cellcard.billing;

public class CancelSubscription extends AbstractMediator{

 SurepayMediator sm = new SurepayMediator();

 public boolean mediate(MessageContext context) { 
   //I need to call that firstValue in here
   return true;
 }
}
取消订阅

package esb.cellcard.billing;

public class AddSubscription extends AbstractMediator{

SurepayMediator sm = new SurepayMediator();

public boolean mediate(MessageContext context) { 
    //I need to call that firstValue in here
    return true;
  }
}
package esb.cellcard.billing;

public class CancelSubscription extends AbstractMediator{

 SurepayMediator sm = new SurepayMediator();

 public boolean mediate(MessageContext context) { 
   //I need to call that firstValue in here
   return true;
 }
}

似乎只有SurepayMediator应该是类中介—您需要从中介中调用的唯一中介

更改类AddSubscription和CancelSubscription,使它们不扩展AbstractMediator

最后,重命名“mediate”方法并使用MessageContext参数从SurepayMediator调用它:您将获得调用context.getPropertyfirstValue的firstValue属性的值

 if(something){
          addSubscription.add(context); 
      }


在你的调解中,你打电话给SurepayMediator,然后再打电话给AddSubscription?@Jean-Michel我改变了我的问题。请检查一下。