Hi Lakmal, Does the metadata service currently provide an endpoint to get the tenant details?
Regards, Chamila de Alwis Software Engineer | WSO2 | +94772207163 Blog: code.chamiladealwis.com On Sun, Sep 21, 2014 at 6:44 AM, Lakmal Warusawithana <[email protected]> wrote: > > > On Sat, Sep 20, 2014 at 11:19 PM, Chamila De Alwis <[email protected]> > wrote: > >> Hi, >> >> I'm in the process of writing the cartridge agent in Python. When >> executing the extensions on tenant event listeners, specifically >> SubscriptionDomainAddedEvent and SubscriptionDomainRemovedEvent, tenant >> domain name should be passed as parameters. Currently CartridgeAgent gets >> the tenant information from TenantManager which collects tenant information >> through the event listener model in messaging. >> >> At this point, I'm stuck at how to get the tenant information for a given >> tenant ID in Python Cartridge Agent. I could execute a REST call to get the >> tenant details[1], but it will involve iterating through the list of >> tenants provided. And, it is a deviation from the design the current agent >> follows. >> >> Second option is to implement a message processing queue, which is the >> approach in the Java cartridge agent, in Python and maintain a tenant >> information context, which would hold all the tenants' details. >> >> Third option is to simply listen to the >> TenantCreatedEvent/TenantSubscribedEvent and add the tenant data to a >> tenant information context. The added information should also be removed at >> a TenantRemovedEvent/TenantUnsubscribedEvent. >> > > You may not get TenantCreate event, because cartridge may not exist at > that time. Then you have to listen to full tenant event (which sending > periodically) first and update tenant context. But IMO, if we can use > metadata service to get tenant information, it would be the best. > > >> >> I'm inclined to follow the third approach, which is much more simpler, >> and works naturally with the Paho mqtt library that is used for >> communication in Python cartridge agent. WDYT? >> >> [1] - >> https://cwiki.apache.org/confluence/display/STRATOS/4.0.0+Listing+Tenants >> >> Regards, >> Chamila de Alwis >> Software Engineer | WSO2 | +94772207163 >> Blog: code.chamiladealwis.com >> >> >> > > > -- > Lakmal Warusawithana > Vice President, Apache Stratos > Director - Cloud Architecture; WSO2 Inc. > Mobile : +94714289692 > Blog : http://lakmalsview.blogspot.com/ > >
