在当前租户中使用本地传输

时间:2017-01-17 08:45:09

标签: wso2 wso2esb wso2carbon

我想在WSO2 ESB上的租户中部署Carbon Application,并在代理之间使用本地传输。当我使用具有完整域的绝对URI时,它看起来工作正常,例如:

local://services/t/my.domain.com/MyFirstProxy

现在我想将消息传递给同一域(租户)中的另一个代理:

local://services/t/my.domain.com/MySecondProxy

我希望有可能通过相对路径(不改变域名)来引用第二代理,例如local:// services / MySecondProxy但是如果我尝试以这种方式使用ESB引擎抛出:

[2017-01-17 09:35:41,648] ERROR - CarbonContextDataHolder Trying to set the domain from my.domain.com to carbon.super
java.lang.IllegalStateException: Trying to set the domain from my.domain.com to carbon.super
        at org.wso2.carbon.context.internal.CarbonContextDataHolder.setTenantDomain(CarbonContextDataHolder.java:1390)
        at org.wso2.carbon.context.PrivilegedCarbonContext.setTenantDomain(PrivilegedCarbonContext.java:152)
        at org.wso2.carbon.context.PrivilegedCarbonContext.setTenantDomain(PrivilegedCarbonContext.java:141)
        at org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator.invoke(CarbonContextConfigurator.java:33)
        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
        at org.apache.axis2.transport.local.LocalTransportReceiver.processMessage(LocalTransportReceiver.java:169)
        at org.apache.axis2.transport.local.LocalTransportReceiver.processMessage(LocalTransportReceiver.java:82)
        at org.wso2.carbon.core.transports.local.CarbonLocalTransportSender.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
        at org.apache.axis2.transport.local.LocalTransportSender.invoke(LocalTransportSender.java:77)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.wso2.carbon.core.multitenancy.transports.TenantTransportSender.invoke(TenantTransportSender.java:236)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
        at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
        at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:581)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:78)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:548)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
        at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
        at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:55)
        at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:121)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:210)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.doSOAP(MultitenantMessageReceiver.java:281)
        at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.processRequest(MultitenantMessageReceiver.java:226)
        at org.wso2.carbon.core.multitenancy.MultitenantMessageReceiver.receive(MultitenantMessageReceiver.java:78)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:403)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

我需要在两个独立的域中独立部署相同的应用程序,我不想使用绝对路径来维护复杂。

是否有一个简单的解决方案来使用本地传输而不修复域名并默认使用当前域?

1 个答案:

答案 0 :(得分:1)

在您的方案中,您在ESB中的租户中使用本地传输。因此,当您要调用基于租户的代理时,必须使用绝对路径。

当您调用不带域的代理时,您会收到错误,因为它会将其分配给carbon super。

仅供参考 - 如果要跨租户进行呼叫,即使它们是从同一个VM运行,也应使用非本地传输。 [1]因此不建议与租户一起使用本地交通工具。

如果需要,可以使用自定义代理路径并参考文档[2]

  1. https://buddhimawijeweera.wordpress.com/2014/11/16/local-transport-in-wso2-esb/
  2. https://docs.wso2.com/display/Carbon440/Adding+a+Custom+Proxy+Path