Publishing Data to BAM as tenant
When data is published to BAM as tenants by only modifying the credentials, events will be received as tenant and will be saved in tenant space in Cassandra. You can publish the events using the local BAM setup as follows.
In this section we shall modify the KPI sample and publish the data as tenant to BAM. Please follow the below instructions to publish data to the tenant space.
Modify the
KPIAgent.java
file in the<PRODUCT_HOME>/samples/kpi-definition/src/main/java/org/wso2/carbon/bam/kpiagent/
directory as follows:DataPublisher dataPublisher = new DataPublisher("tcp://" + host + ":7611", "tenantusername@tenantadmin.com", "admin123”, agent);
In the above modification, thetenantusername
is the username of the tenant, which you have created and,tenantadmin.com
is the domain name, which you have registered for the tenant. Tenant password isadmin123
.Navigate to
<PRODUCT_HOME>/samples/kpi-definition/
directory from the command line, and run the ant script by typing 'ant'
, to publish the events to your tenant space.Log in to BAM management console as tenant. In the management console, click Main, then click Cassandra Explorer and then click Connect to cluster. Then log in to the Cassandra cluster using the tenant credentials as shown in the below example.
Connection URL = 9160 + <port-offsett> username = tenantusername@tenantadmin.com password = admin123
- Click EVENT_KS and view the published data in the
org_wso2_bam_phone_retail_store_kpi
(stream name) column family as follows: