Hi all,

I was able to get this working with axis2 handler and small change to
synapse-greg registry bridge.
Now both GReg integration and security scenarios working fine.

Still we need to assess overhead of setting thread local in every message.

On Fri, Jul 12, 2013 at 11:40 AM, Amila Suriarachchi <am...@wso2.com> wrote:

>
>
>
> On Fri, Jul 12, 2013 at 11:33 AM, Miyuru Wanninayaka <miy...@wso2.com>wrote:
>
>> Hi Amila,
>>
>> On Fri, Jul 12, 2013 at 11:27 AM, Amila Suriarachchi <am...@wso2.com>wrote:
>>
>>>
>>>
>>>
>>> On Fri, Jul 12, 2013 at 11:17 AM, Miyuru Wanninayaka <miy...@wso2.com>wrote:
>>>
>>>> Hi Dushan,
>>>>
>>>> Dispatcher/Handler will only help in cases where message come to
>>>> synapse from outside.
>>>>
>>>> For other cases, we need to develop a extension point in synapse which
>>>> invokes after a thread spawn to set CC as thread local.
>>>>
>>>> Seems we can get AxisConfiguration in any place which synapse create a
>>>> new thread. So we can develop a handler API which has something like
>>>>
>>>> public void populateThreadLocal(AxisConfiguration) or something
>>>>
>>>> which figure out tenant information and  polulate CC.
>>>>
>>>> @Azeez, can we figure out tenant information by looking at
>>>> AxisConfiguration?
>>>> Using something like AxisConfiguration.getRepository()
>>>
>>>
>>> In here you need to think about how to get the tenant information from
>>> the request message. Always we need to get the tenant information from the
>>> request message and set to thread local. There are two ways
>>>
>>> 1. From the request URI
>>> 2. user name - user can have tenant qualified name
>>>
>>
>> both these are not available for pooling/non-http transports
>>
>
> We don't support those transports for MT. Those transports only for ST. So
> we can assume always ST for those transports.
>
> thanks,
> Amila.
>
>>
>>
>>> thanks,
>>> Amila.
>>>
>>>>
>>>>
>>>> On Fri, Jul 12, 2013 at 10:19 AM, Dushan Abeyruwan <dus...@wso2.com>wrote:
>>>>
>>>>> Hi Miyru,
>>>>>    I think we can intercept the Carbon context by writing a dispatch
>>>>> in DispatchPhase this can be a component whose suppose to resides outside
>>>>> synapse.
>>>>>
>>>>>
>>>>> Cheers
>>>>> Dushan
>>>>>
>>>>>
>>>>> On Fri, Jul 12, 2013 at 9:58 AM, Afkham Azeez <az...@wso2.com> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Jul 12, 2013 at 9:54 AM, Miyuru Wanninayaka 
>>>>>> <miy...@wso2.com>wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Jul 12, 2013 at 9:36 AM, Afkham Azeez <az...@wso2.com>wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Jul 12, 2013 at 7:28 AM, Miyuru Wanninayaka <
>>>>>>>> miy...@wso2.com> wrote:
>>>>>>>>
>>>>>>>>> Hi Azeez,
>>>>>>>>>
>>>>>>>>> Sorry, we were not properly following dev@ discussions recently
>>>>>>>>> as team was very busy with ESB 4.7 release.
>>>>>>>>>
>>>>>>>>> Yes we can set proper CC as thread local in request path via
>>>>>>>>> handler for NIO transports by looking at To address. But how this can
>>>>>>>>> implement in generic manner for other transport ( JMS, VFS....). May 
>>>>>>>>> be
>>>>>>>>> since other transports does not support MT anyway, we can always set 
>>>>>>>>> ST CC
>>>>>>>>> for non http transports?
>>>>>>>>>
>>>>>>>>> Also how we can handle thread switching in response path of NIO?
>>>>>>>>> Handler will not help in response path.
>>>>>>>>>
>>>>>>>>> Also there are some mediation threads spawns within synapse
>>>>>>>>> without going through axis2 flow such as
>>>>>>>>> * Synapse tasks
>>>>>>>>> * Message processors
>>>>>>>>> * Priority executors
>>>>>>>>> * Clone and iterate mediators
>>>>>>>>>
>>>>>>>>> How can we set CC in these cases?
>>>>>>>>
>>>>>>>>
>>>>>>>> Any bit of execution has to to be associated with some tenant. It
>>>>>>>> is true for everything listed above. We need to track things like how 
>>>>>>>> much
>>>>>>>> CPU time each tenant consumed and so on. So you need to identify the
>>>>>>>> relevant plug points, and inject the proper CC.
>>>>>>>>
>>>>>>>
>>>>>>> Only problem is above mentioned flows cannot intercept from outside
>>>>>>> of synapse. In such case do we have alternative than writing carbon
>>>>>>> specific code inside synapse?
>>>>>>>
>>>>>>
>>>>>>
>>>>>> No. This is why interfaces are needed. We have done this enough &
>>>>>> more time for Axis2, without writing WSO2 specific code in Axis2.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Jul 11, 2013 at 9:50 PM, Afkham Azeez <az...@wso2.com>wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, Jul 11, 2013 at 7:59 PM, Miyuru Wanninayaka <
>>>>>>>>>> miy...@wso2.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> ESB does not sets Carbon Context as thread local because
>>>>>>>>>>> PTT/NHTTP threads are totally under synapse. AFIK only servlet 
>>>>>>>>>>> transport
>>>>>>>>>>> sets CC as a thread local.
>>>>>>>>>>>
>>>>>>>>>>> In 4.1.0 branch this is working fine without setting CC as
>>>>>>>>>>> thread local. Did something changed in trunk?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Please keep yourself up to date on what is going on at the
>>>>>>>>>> platform level. Platform level enhancements have an effect on all 
>>>>>>>>>> products.
>>>>>>>>>> There have been several mail threads on this. you should be able to 
>>>>>>>>>> define
>>>>>>>>>> a handler which sets the proper CC into the Thread.
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jul 11, 2013 at 7:49 PM, Amila Suriarachchi <
>>>>>>>>>>> am...@wso2.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Jul 11, 2013 at 7:31 PM, Miyuru Wanninayaka <
>>>>>>>>>>>> miy...@wso2.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Amila,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Are you referring to CarbonContext thread local variable?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> yes it gets the tenant domain like this
>>>>>>>>>>>>
>>>>>>>>>>>> public static String getTenantDomain() {
>>>>>>>>>>>>         return getCarbonContext().getTenantDomain();
>>>>>>>>>>>>     }
>>>>>>>>>>>>
>>>>>>>>>>>> thanks,
>>>>>>>>>>>> Amila.
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Jul 11, 2013 at 6:27 PM, Amila Suriarachchi <
>>>>>>>>>>>>> am...@wso2.com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Thu, Jul 11, 2013 at 4:40 PM, Dushan Abeyruwan <
>>>>>>>>>>>>>> dus...@wso2.com> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>>  Getting following error when executing proxy service ESB
>>>>>>>>>>>>>>> 4.8.0 built 2013-07-11
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> [2013-07-11 16:37:22,177]  INFO - ProxyService Building Axis
>>>>>>>>>>>>>>> service for Proxy service : SearchTwitter
>>>>>>>>>>>>>>> [2013-07-11 16:37:22,177]  INFO - ProxyService Adding
>>>>>>>>>>>>>>> service SearchTwitter to the Axis2 configuration
>>>>>>>>>>>>>>> [2013-07-11 16:37:22,182]  INFO - DeploymentInterceptor
>>>>>>>>>>>>>>> Deploying Axis2 service: SearchTwitter {super-tenant}
>>>>>>>>>>>>>>> [2013-07-11 16:37:22,208]  INFO - ProxyService Successfully
>>>>>>>>>>>>>>> created the Axis2 service for Proxy service : SearchTwitter
>>>>>>>>>>>>>>> [2013-07-11 16:37:29,694]  INFO - LogMediator To:
>>>>>>>>>>>>>>> /services/SearchTwitter, WSAction: urn:getQuote, SOAPAction: 
>>>>>>>>>>>>>>> urn:getQuote,
>>>>>>>>>>>>>>> MessageID: urn:uuid:6421430e-e95c-4aa2-a9ba-f*cd37f7753e3,
>>>>>>>>>>>>>>> Direction: request*
>>>>>>>>>>>>>>> *[2013-07-11 16:37:29,695] ERROR - NativeWorkerPool
>>>>>>>>>>>>>>> Uncaught exception*
>>>>>>>>>>>>>>> *java.lang.NullPointerException*
>>>>>>>>>>>>>>> * at
>>>>>>>>>>>>>>> java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>> * at
>>>>>>>>>>>>>>> org.wso2.carbon.caching.impl.CacheManagerFactoryImpl.getCacheManager(CacheManagerFactoryImpl.java:78)
>>>>>>>>>>>>>>> *
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.wso2.carbon.registry.core.utils.RegistryUtils.getCacheManager(RegistryUtils.java:289)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.wso2.carbon.registry.core.utils.RegistryUtils.getResourceCache(RegistryUtils.java:272)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.getCache(CacheBackedRegistry.java:62)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:246)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:629)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.wso2.carbon.mediation.registry.WSO2Registry.getResource(WSO2Registry.java:527)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.wso2.carbon.mediation.registry.WSO2Registry.lookup(WSO2Registry.java:131)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.synapse.registry.AbstractRegistry.getResource(AbstractRegistry.java:63)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.synapse.config.SynapseConfiguration.getSequenceTemplate(SynapseConfiguration.java:395)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.synapse.core.axis2.Axis2MessageContext.getSequenceTemplate(Axis2MessageContext.java:191)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:71)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:162)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:404)
>>>>>>>>>>>>>>> at
>>>>>>>>>>>>>>> org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:184)
>>>>>>>>>>>>>>>  at
>>>>>>>>>>>>>>> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(Nat
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> seems like tenant domain is null for the threads originating
>>>>>>>>>>>>>> from passthrough transport threads. Can you please check the 
>>>>>>>>>>>>>> tenant domain
>>>>>>>>>>>>>> of the pass through transport threads?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> thanks,
>>>>>>>>>>>>>> Amila.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> Dushan Abeyruwan
>>>>>>>>>>>>>>> Associate Tech Lead
>>>>>>>>>>>>>>> *Integration Technologies Team*
>>>>>>>>>>>>>>> *WSO2 Inc. http://wso2.com/*
>>>>>>>>>>>>>>> *Mobile:(+94)714408632*
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> *Amila Suriarachchi*
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Software Architect
>>>>>>>>>>>>>> WSO2 Inc. ; http://wso2.com
>>>>>>>>>>>>>> lean . enterprise . middleware
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> phone : +94 71 3082805
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> Dev mailing list
>>>>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Miyuru Wanninayaka
>>>>>>>>>>>>> Technical Lead
>>>>>>>>>>>>> WSO2 Inc. : http://wso2.com
>>>>>>>>>>>>>
>>>>>>>>>>>>> Mobile : +94 77 209 9788
>>>>>>>>>>>>> Blog : http://miyurudw.blogspot.com
>>>>>>>>>>>>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> *Amila Suriarachchi*
>>>>>>>>>>>>
>>>>>>>>>>>> Software Architect
>>>>>>>>>>>> WSO2 Inc. ; http://wso2.com
>>>>>>>>>>>> lean . enterprise . middleware
>>>>>>>>>>>>
>>>>>>>>>>>> phone : +94 71 3082805
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Miyuru Wanninayaka
>>>>>>>>>>> Technical Lead
>>>>>>>>>>> WSO2 Inc. : http://wso2.com
>>>>>>>>>>>
>>>>>>>>>>> Mobile : +94 77 209 9788
>>>>>>>>>>> Blog : http://miyurudw.blogspot.com
>>>>>>>>>>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> Dev mailing list
>>>>>>>>>>> Dev@wso2.org
>>>>>>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *Afkham Azeez*
>>>>>>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>>>>>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>>>>>>>> * <http://www.apache.org/>**
>>>>>>>>>> email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
>>>>>>>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>>>>>>>> twitter: 
>>>>>>>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>>>>>>>>> *
>>>>>>>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>>>>>>>>> *
>>>>>>>>>> *
>>>>>>>>>> *Lean . Enterprise . Middleware*
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Miyuru Wanninayaka
>>>>>>>>> Technical Lead
>>>>>>>>> WSO2 Inc. : http://wso2.com
>>>>>>>>>
>>>>>>>>> Mobile : +94 77 209 9788
>>>>>>>>> Blog : http://miyurudw.blogspot.com
>>>>>>>>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Afkham Azeez*
>>>>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>>>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>>>>>> * <http://www.apache.org/>**
>>>>>>>> email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
>>>>>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>>>>>> twitter: 
>>>>>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>>>>>>> *
>>>>>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>>>>>>> *
>>>>>>>> *
>>>>>>>> *Lean . Enterprise . Middleware*
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Miyuru Wanninayaka
>>>>>>> Technical Lead
>>>>>>> WSO2 Inc. : http://wso2.com
>>>>>>>
>>>>>>> Mobile : +94 77 209 9788
>>>>>>> Blog : http://miyurudw.blogspot.com
>>>>>>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Afkham Azeez*
>>>>>> Director of Architecture; WSO2, Inc.; http://wso2.com
>>>>>> Member; Apache Software Foundation; http://www.apache.org/
>>>>>> * <http://www.apache.org/>**
>>>>>> email: **az...@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
>>>>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>*
>>>>>> twitter: 
>>>>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
>>>>>> *
>>>>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez*
>>>>>> *
>>>>>> *
>>>>>> *Lean . Enterprise . Middleware*
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dushan Abeyruwan
>>>>> Associate Tech Lead
>>>>> *Integration Technologies Team*
>>>>> *WSO2 Inc. http://wso2.com/*
>>>>> *Mobile:(+94)714408632*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Miyuru Wanninayaka
>>>> Technical Lead
>>>> WSO2 Inc. : http://wso2.com
>>>>
>>>> Mobile : +94 77 209 9788
>>>> Blog : http://miyurudw.blogspot.com
>>>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev@wso2.org
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Amila Suriarachchi*
>>>
>>> Software Architect
>>> WSO2 Inc. ; http://wso2.com
>>> lean . enterprise . middleware
>>>
>>> phone : +94 71 3082805
>>>
>>
>>
>>
>> --
>> Miyuru Wanninayaka
>> Technical Lead
>> WSO2 Inc. : http://wso2.com
>>
>> Mobile : +94 77 209 9788
>> Blog : http://miyurudw.blogspot.com
>> Flickr : http://www.flickr.com/photos/miyuru_daminda
>>
>
>
>
> --
> *Amila Suriarachchi*
>
> Software Architect
> WSO2 Inc. ; http://wso2.com
> lean . enterprise . middleware
>
> phone : +94 71 3082805
>



-- 
Miyuru Wanninayaka
Technical Lead
WSO2 Inc. : http://wso2.com

Mobile : +94 77 209 9788
Blog : http://miyurudw.blogspot.com
Flickr : http://www.flickr.com/photos/miyuru_daminda
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to