...
Configure the deployment descriptor.
In order to specify the server configuration details, and monitoring data (Payload, Correlation and Meta), BPS uses an XML configuration file. This configuration file should specify the BPEL process in the deploy.xml file (deployment descriptor file for a BPEL package). The BAM server profile is specified as follows:Code Block language html/xml <bamServerProfiles> <profile name="BAMServerProfile" location="file:BAMServerProfile.xml"/> </bamServerProfiles>
The
<bamServerProfiles>
element should come under the process element in deployment descriptor (deploy.xml). The following is an example of a deployment descriptor.Code Block language html/xml <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:SalesData="http://www.samples.wso2.org/bps/SalesData/" xmlns:samples.bps.wso2.org="http://samples.bps.wso2.org"> <process name="samples.bps.wso2.org:KPISampleProcess"> <active>true</active> <retired>false</retired> <process-events generate="all"/> <provide partnerLink="client"> <service name="samples.bps.wso2.org:KPISampleProcess" port="KPISampleProcessPort"/> </provide> <bamServerProfiles> <profile name="BAMServerProfile" location="file:BAMServerProfile.xml"/> </bamServerProfiles> </process> </deploy>
The ‘file:
‘ inlocation
is used to specify a file path. Similarly, the BAM server profile can be kept in the WSO2 registry as well. If the BAM server profile file is stored in configuration registry, it can be referred to asconf:<resource path>
. Similarly, if the BAM server profile is stored in the Governance Registry, it can be referred to asgov:<resource path>
.Create the BAM server profile.
BAM server profile is an XML file with the following structure:Code Block language html/xml <ServerProfile name=””> <Connection/> <Credential/> <Streams> <Stream/> ... ... <Stream/> </Streams> </ServerProfile>
BAM Server Profile Elements
The connection element is used to describe the BAM2 server information. Credential element describes the authentication info to authenticate to the BAM2 server. Under the<Streams>
element, many BAM streams can be defined. The following is the structure for a BAM stream definition:Code Block language html/xml <Stream name="org.wso2.bam.phone.retail.store.kpi" version="1.0.0" nickName="Phone_Retail_Shop" description="Phone Sales"> <Data> <Key name="brand" type="payload"> <From variable="brand"/> </Key> <Key name="quantity" type="payload"> <From variable="quantity"/> </Key> <Key name="user" type="payload"> <From variable="user"/> </Key> <Key name="total" type="payload"> <From variable="total"/> </Key> </Data> </Stream>
A BAM2
<Stream>
definition should have the properties, ‘name
’, ‘version
’, ‘nickName
’ and ‘description
’. Under the<Stream>
element, each of the data items published to BAM is specified using the<Data>
element.Code Block language html/xml <Data> <key name=”” type=”payload | meta | correlation”> <From variable=”quantity”/> </key> <Data>
The
name
attribute of the<key>
element describes the key used by BAM to identify the given data item and thetype
attribute describes the type of data item. BAM2 has three types of data. They are meta data, payload data and correlation data. This can be specified using the type attribute. The standardFrom
syntax from BPEL is used to select the value of each key. When selecting a variable to be published to BAM, it can be specified as<From variable=”quantity”/>.
The variable name should be the same name used in the BPEL process. The following is a complete example of a BAMServer Profile:Code Block language html/xml <ServerProfile xmlns="http://wso2.org/bam/2.0" name="BAMServerProfile"> <Connection enableLoadBalancing="false" url="tcp://127.0.0.1:7611"/> <Credential userName="admin" password="kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg="/> <!-- KeyStore location="<BAM_HOME>/repository/resources/security/client-truststore.jks" password="CpIZ4fbSj03GQyiNSVUJCbX/6UMJJbaTNOzPKtFlkC0="/--> <Streams> <Stream name="org.wso2.bam.phone.retail.store.kpi" version="1.0.0" nickName="Phone_Retail_Shop" description="Phone Sales"> <Data> <Key name="brand" type="payload"> <From variable="brand"/> </Key> <Key name="quantity" type="payload"> <From variable="quantity"/> </Key> <Key name="user" type="payload"> <From variable="user"/> </Key> <Key name="total" type="payload"> <From variable="total"/> </Key> </Data> </Stream> </Streams> </ServerProfile>
Set enableLoadBalancing to "true" with a comma separated urls to publish in multiple BAM receiver nodes.
Receiver URL= tcp://<BAM Receiver -1>:<port>,tcp://<BAM Receiver -2>:<port>,tcp://<BAM Receiver -3>:<port>
eg: <Connection enableLoadBalancing="true" url="tcp://127.0.0.1:7611,tcp://127.0.0.1:7613"/>
...