Hi Dilini/Asanka,

On Tue, Jul 22, 2014 at 7:18 PM, Dilini Muthumala <dil...@wso2.com> wrote:

> Hi Asanka,
> I believe,
> PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
> works in other tomcat-webapps, but does not return correct tenant id when
> used with web socket endpoints.
>
> Hi Malintha and Gayashan,
> Thanks for the info. It seems that this is not something happening due
> to CARBON-14807.
>

​Thanks for the discussion. I'm also still learning. As i said CARBON-14807
is an issue occuring when "super-tenant related tasks are logged", which is
an issue caused by not properly setting the tenant information in the
carbon context. I think that's why Malintha mentioned it here. This issue
is not happening due to CARBON-14807.


> Hi Kasun,
> On Tue, Jul 22, 2014 at 5:45 PM, Kasun Gajasinghe <kas...@wso2.com> wrote:
>
>> What's the product you are trying this in?
>>
> I'm trying with CEP (version 4.0.0, Milestone 1 release)
>
>
>> Can you open up CARBON_HOME/repository/conf/tomcat/catalina-server.xml,
>> and make sure that it has the following valve defined?
>>
>>       <Valve
>> className="org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve"/>
>>
>
> I checked this. It's defined.
>
> It seems, this issue is specific to web socket end points, hosted on
> carbon servers.
>
​
If you are to have access to the tenant information through carbon context,
that information should have to be set in the relevant thread when the
thread is created (or obviously before getTenantId() is accessed). I will
try to look into how this is handled in carbon and provide more information.
​

>
> Thank you everyone for your helpful suggestions.
> Dilini
>
>>
>> The reported jira that is mentioned above is an issue with logging.
>>
>>
>>
>> On Tue, Jul 22, 2014 at 4:58 AM, Asanka Dissanayake <asan...@wso2.com>
>> wrote:
>>
>>>
>>>
>>>
>>> On Tue, Jul 22, 2014 at 5:23 PM, Asanka Dissanayake <asan...@wso2.com>
>>> wrote:
>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jul 22, 2014 at 5:03 PM, Gayashan Amarasinghe <
>>>> gayas...@wso2.com> wrote:
>>>>
>>>>> Hi Dilini,
>>>>>
>>>>> Did you deploy the web app as super tenant or a tenant? What are the
>>>>> server versions you used?
>>>>>
>>>>> Method you have used is the proper way to access the tenant Id.
>>>>>
>>>> AFAIK you shouldn't use PrivilegedCarbonContext to read information. It
>>>> is used to write stuffs to the carbon context.
>>>>
>>> For more information:
>>>
>>> PrivilegedCarbonContext
>>>
>>> PrivilegedCarbonContext is a special subclass of CarbonContext, which
>>> allows you to perform privileged operations such as, setting the tenant ID
>>> and domain, starting or ending tenant flows and more. This class can only
>>> be used by Carbon components that have the permission to get hold of an
>>> instance of the PrivilegedCarbonContext.
>>>
>>>
>>> CarbonContext
>>> The CarbonContext is designed for normal tenants to retrieve
>>> information from the Carbon runtime. In the super tenant mode, for this to
>>> work the relevant data has to be set so that tenants can retrieve
>>> information using the CarbonContext.
>>>
>> ​
Thanks for the insight. I have observed the PrivilegedCarbonContext code
and it is capable of resolving the tenant Id from the tenant domain name.
May be it can be used in such a scenario?

Thanks.

/Gayashan
​

>    However as Malintha has mentioned, there are some bugs when certain
>>>>> super-tenant related tasks are logged, which has not been observed for
>>>>> tenant-wise tasks. This bug will be fixed with 4.3 release.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> /Gayashan
>>>>>
>>>>>
>>>>> On Tue, Jul 22, 2014 at 3:29 PM, Dilini Muthumala <dil...@wso2.com>
>>>>> wrote:
>>>>>
>>>>>>  Hi,
>>>>>>
>>>>>> Would like to know, how to $subject.
>>>>>>
>>>>>> I tired with,
>>>>>> PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
>>>>>>
>>>>>> which returned -1, as the tenant id.
>>>>>>
>>>>>> Thanks,
>>>>>> Dilini
>>>>>>
>>>>>> --
>>>>>> *Dilini Muthumala*
>>>>>> Software Engineer,
>>>>>> WSO2 Inc.
>>>>>>
>>>>>> *E-mail :* dil...@wso2.com
>>>>>> *Mobile: *+94713 400 029
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev@wso2.org
>>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Gayashan Amarasinghe*
>>>>> Software Engineer | Platform TG
>>>>> WSO2, Inc. | http://wso2.com
>>>>> lean. enterprise. middleware
>>>>>
>>>>> Mobile : +94718314517
>>>>> Blog : gayashan-a.blogspot.com
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> *Asanka DissanayakeSoftware Engineer*
>>>> *WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>>> <http://wso2.com/>*
>>>>
>>>> *email: asan...@wso2.com <ruch...@wso2.com>,   blog:
>>>> cyberwaadiya.blogspot.com
>>>> <http://cyberwaadiya.blogspot.com>, asankastechtalks.wordpress.com
>>>> <http://asankastechtalks.wordpress.com>  mobile: +94 71 8373821*
>>>>
>>>
>>>
>>>
>>> --
>>>
>>>
>>> *Asanka DissanayakeSoftware Engineer*
>>> *WSO2 Inc. - lean . enterprise . middleware |  wso2.com
>>> <http://wso2.com/>*
>>>
>>> *email: asan...@wso2.com <ruch...@wso2.com>,   blog:
>>> cyberwaadiya.blogspot.com
>>> <http://cyberwaadiya.blogspot.com>, asankastechtalks.wordpress.com
>>> <http://asankastechtalks.wordpress.com>  mobile: +94 71 8373821*
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>>
>> *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc.
>> email: kasung AT spamfree wso2.com
>> linked-in: http://lk.linkedin.com/in/gajasinghe
>> blog: http://kasunbg.org
>>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Dilini Muthumala*
> Software Engineer,
> WSO2 Inc.
>
> *E-mail :* dil...@wso2.com
> *Mobile: *+94713 400 029
>



-- 
*Gayashan Amarasinghe*
Software Engineer | Platform TG
WSO2, Inc. | http://wso2.com
lean. enterprise. middleware

Mobile : +94718314517
Blog : gayashan-a.blogspot.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to