In this scenario have requests from Gold and Silver customers.
• Gold customers may execute 10 requests per minute
• Silver customers may execute 5 requests per minute
The customer status is stored in the http header – custStatus.
I created the following policies in OEG Policy Studio –
To begin with I create a policy for Silver customers -
I then create one for gold customers -
I create a 3rd policy - StatusBasedThrottling which essentially does the following -
1
- Extract the custStatus
- Switch on the custStatus value calling either the gold or silver policy
- Success Path - just reflect the message back to the caller
- Failure Path - trigger an email alert
- save the request to a message queue for later processing.
Let's see how each has been defined -
Now we need to configure the External Connection for JMS -
Create a JMS Q and Connection Factory on WLS -
jms/myThrottlingQueue
jms/myCF
In a previous step we have configured the Messaging System filter to write to
jms/myThrottlingQueue
Now I create a relative path -
Now we can deploy the policy, but first we need to add wls client to the oeg classpath -
Restart OEG and you will see the JMS lookup -
Test using Service Explorer -
The 6th request returns an error
Check email
Check Queue
No comments:
Post a Comment