use grep to search specific file types only

find -name '*.java' -exec grep regex {} \+

Update throttling without restarting API Manager


1. Invoke API Calls using the Access token (for keep cache)
2. Select API/Application subscription record from table & update to relevant throttle

mysql> update am_subscription set TIER_ID='Unlimited' where APPLICATION_ID='12' and API_ID=5;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from am_subscription where APPLICATION_ID='12' and API_ID=5;
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
| SUBSCRIPTION_ID | TIER_ID   | API_ID | LAST_ACCESSED | APPLICATION_ID | SUB_STATUS | SUBS_CREATE_STATE | CREATED_BY | CREATED_TIME        | UPDATED_BY | UPDATED_TIME        | UUID                                 |
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
|              12 | Unlimited |      5 | NULL          |             12 | UNBLOCKED  | SUBSCRIBE         | hubsp1     | 2018-05-16 11:34:21 | NULL       | 2018-05-16 11:34:21 | 8cc991d7-5bf8-45bb-be50-c1724ac7b944 |
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
1 row in set (0.00 sec)

mysql> update am_subscription set TIER_ID='Gold' where APPLICATION_ID='12' and API_ID=5;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from am_subscription where APPLICATION_ID='12' and API_ID=5;
+-----------------+---------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
| SUBSCRIPTION_ID | TIER_ID | API_ID | LAST_ACCESSED | APPLICATION_ID | SUB_STATUS | SUBS_CREATE_STATE | CREATED_BY | CREATED_TIME        | UPDATED_BY | UPDATED_TIME        | UUID                                 |
+-----------------+---------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
|              12 | Gold    |      5 | NULL          |             12 | UNBLOCKED  | SUBSCRIBE         | hubsp1     | 2018-05-16 11:34:21 | NULL       | 2018-05-16 11:34:21 | 8cc991d7-5bf8-45bb-be50-c1724ac7b944 |
+-----------------+---------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
1 row in set (0.00 sec)

mysql> update am_subscription set TIER_ID='Unlimited' where APPLICATION_ID='12' and API_ID=5;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from am_subscription where APPLICATION_ID='12' and API_ID=5;
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
| SUBSCRIPTION_ID | TIER_ID   | API_ID | LAST_ACCESSED | APPLICATION_ID | SUB_STATUS | SUBS_CREATE_STATE | CREATED_BY | CREATED_TIME        | UPDATED_BY | UPDATED_TIME        | UUID                                 |
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
|              12 | Unlimited |      5 | NULL          |             12 | UNBLOCKED  | SUBSCRIBE         | hubsp1     | 2018-05-16 11:34:21 | NULL       | 2018-05-16 11:34:21 | 8cc991d7-5bf8-45bb-be50-c1724ac7b944 |
+-----------------+-----------+--------+---------------+----------------+------------+-------------------+------------+---------------------+------------+---------------------+--------------------------------------+
1 row in set (0.00 sec)

3. Using API Manager admin service (APIAuthenticationService) invoke invalidateCachedTokens as per below (+ basic auth)

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.security.handlers.gateway.apimgt.carbon.wso2.org">
   <soap:Header/>
   <soap:Body>
      <ser:invalidateCachedTokens>
         <!--Zero or more repetitions:-->
         <ser:accessTokens>cee59744-4e64-303a-aa45-5631e2c6953c</ser:accessTokens>
      </ser:invalidateCachedTokens>
   </soap:Body>
</soap:Envelope>

4. continue API invoking & confirm

curl -X POST http://54.193.104.15:8280/paym4-303a-aa45-5631e2c6953c' -H 'content-type: application/json' -d '{ "amountTransaction": { "clientCorrelator": "123456", "endUserId": "tel:+94777323222", "paymentAmount": { "chargingInformation": { "amount": "0.01", "code": "PRBT", "currency": "LKR", "description": "In game currency" }, "chargingMetaData": { "channel": "WEB", "onBehalfOf": "MIFE_TEST", "purchaseCategoryCode": "STEAM", "serviceID": "eab99ce6-62fd-43d1-8952-f2dffdb144ac", "taxAmount": "0" } }, "referenceCode": "715", "transactionOperationStatus": "Charged" } }'
{"fault":{"code":900800,"message":"Message throttled out","description":"You have exceeded your quota"}}

WSO2 Solr Index

  1. Delete the solar directory.
  2. Open registry.xml and change the following line as shown below.
    • <lastAccessTimeLocation>/_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime-1</lastAccessTimeLocation>
  3. Now restart the server. The server will re-index all the files again (It may get some time to this process after restart).
  4. Also, make sure the Databases are properly configured. Specially Registry mounting related configurations.