public interface LimiterEndpoint
LimiterEndpoint
objects are the interface between the Rate Limiting system and an RA or SBB
that uses the Rate Limiting system. They cannot be created directly, instead they are declared in extension
deployment descriptors and the SLEE will pass suitable implementations to an RA via ConfigProperties and
to an SBB via JNDI.
There is no restriction on the number of endpoints used in an RA / SBB.
To use a LimiterEndpoint
you first need to:
To declare a limiter endpoint for an RA
Declare the limiter endpoint in the RA extension deployment descriptor (oc-resource-adaptor-jar_2_1.xml):
Declare the limiter endpoint in the SBB extension deployment descriptor (oc-sbb-jar_2_1.xml):
To declare a limiter endpoint for an SBB
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE oc-resource-adaptor-jar PUBLIC
"-//Open Cloud Ltd.//DTD JAIN SLEE Resource Adaptor Extension 1.1.1//EN"
"http://www.opencloud.com/dtd/oc-resource-adaptor-jar_1_1_1.dtd">
<oc-resource-adaptor-jar>
<resource-adaptor id="Example RA">
...
<limiter-endpoint-ref>
<description>Optional description of the endpoint</description>
<limiter-endpoint-ref-name>limiter/myEndpoint</limiter-endpoint-ref-name>
<limiter-endpoint-name>myEndpoint</limiter-endpoint-name>
</limiter-endpoint-ref>
...
</resource-adaptor>
</oc-resource-adaptor-jar>
To look up a limiter endpoint for an RA
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE oc-sbb-jar PUBLIC
"-//Open Cloud Ltd.//DTD JAIN SLEE SBB Extension 1.1.1//EN"
"http://www.opencloud.com/slee/oc-sbb-jar_1_1_1.dtd">
<oc-sbb-jar>
<sbb id="Example SBB">
...
<limiter-endpoint-ref>
<description>Optional description of the endpoint</description>
<limiter-endpoint-ref-name>limiter/myEndpoint</limiter-endpoint-ref-name>
<limiter-endpoint-name>myEndpoint</limiter-endpoint-name>
</limiter-endpoint-ref>
...
</sbb>
</oc-sbb-jar>
To look up a limiter endpoint for an SBB
public class MyResourceAdapter implements ResourceAdaptor {
private RateLimiterEndpoint myEndpoint;
public void raConfigure(ConfigProperties configProperties) {
...
this.myEndpoint = (RateLimiterEndpoint) configProperties.getProperty("limiter/myEndpoint").getValue();
...
}
...
}
public class MySbb implements Sbb {
private RateLimiterEndpoint myEndpoint;
public void setSbbContext(SbbContext ctx) {
...
try {
final Context env = (Context) new InitialContext().lookup("java:comp/env");
this.myEndpoint = (RateLimiterEndpoint) env.lookup("limiter/myEndpoint");
} catch (NamingException e) {
getTracer().warning("Exception getting limiter endpoint 'limiter/myEndpoint'", e);
}
...
}
...
}
RateLimiterEndpoint