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.

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

Reply via email to