The SLA, or Alert Rules, are created via the Service Bus Console. It can not be done via Oracle Workshop (Eclipse).
The big issue with these SLA's, is the deployment. If you have dozens of services, with multiple operations, and you have a lot of environments it takes a while to create them. There is no way to define them, export and load them into another environment, apart of using the web console.
Workarround
A have a nice workaround this a relative easy to implement into multiple environments.The tasks you have to do are:
- Export the OSB Configuratie from Eclipse/ANT to a configuration file (ex. sbconfig.jar)
- Unzip de sbconfig.jar into temporary directory
- Inject the SLA rulez into the proxy files just before the </xml-fragment>
- Create new sbconfig.jar
- Import the file via console using advanced options: unchecked option “Preserve Operational Values”
- Activate
Before you can inject the SLA rules, you have to create them. :-). Creating is done via the normal way. You do this via the console. Now comes the trick. If the SLA is defined, tested etc, you export the all the services that contains SLA's.
The export is also done via the Service Bus Console. The resulted file, sbconfig.jar is downloaded to your workstation.
Unzip this file into a temporary directory. Now open all the proxy files in your favourite editor. Take a look at the end of the file. and copy all the code between the tags
<ser:alertRules> <ser:alertRule enabled="true" name="CountRule"> <aler:description>CountRule</aler:description> <aler:AlertFrequency>every-time</aler:AlertFrequency> <aler:AlertSeverity>normal</aler:AlertSeverity> <aler:StopProcessing>false</aler:StopProcessing> <aler:Condition type="statistics"> <aler:config xmlns:mon="http://www.bea.com/wli/monitoring/alert/condition/monitoring statistic" aggregation-interval="1" xsi:type="mon:monitoringConditionType"> <mon:monCondExpr> <mon:function>count</mon:function> <mon:lhs>Folder$MyServiceProxy$ProxyService/PS_MyService_v0r0/Operation/ReadData/message-count</mon:lhs> <mon:lhs-operand-type xsi:nil="true"/> <mon:lhsDisplayName>Operation.ReadData.Message Count</mon:lhsDisplayName> <mon:operator>=</mon:operator> <mon:rhs>1</mon:rhs> </mon:monCondExpr> </aler:config> </aler:Condition> <aler:AlertDestination ref="SharedObjects/alert/errorDestination"/> <aler:AlertSummary>CountRule</aler:AlertSummary> </ser:alertRule> </ser:alertRules> </xml-fragment>
Save this piece of code for each service into a sla.xml file. For example, you could create a new folder into the OSB project named 'sla' for this service.
A minor change need to be made in this file, the
<ser:alertRules xmlns:aler="http://www.bea.com/wli/monitoring/alert" xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
Now you can use this file to inject it in your proxies during deployment to various environments.
I want also thanks Eric Elzinga on discussing this issue to find a proper solution.