use of org.wso2.carbon.apimgt.impl.notifier.Notifier in project carbon-apimgt by wso2.
the class TokenRevocationNotifierImpl method sendMessageOnRealtime.
/**
* Method to publish the revoked token on to the realtime message broker
*
* @param revokedToken requested revoked token
* @param properties realtime notifier properties read from the config
*/
@Override
public void sendMessageOnRealtime(String revokedToken, Properties properties) {
// Variables related to Realtime Notifier
String realtimeNotifierTTL = realTimeNotifierProperties.getProperty("ttl", DEFAULT_TTL);
long expiryTimeForJWT = Long.parseLong(properties.getProperty("expiryTime"));
String eventId = properties.getProperty(APIConstants.NotificationEvent.EVENT_ID);
String tokenType = properties.getProperty(APIConstants.NotificationEvent.TOKEN_TYPE);
int tenantId = (int) properties.get(APIConstants.NotificationEvent.TENANT_ID);
Object[] objects = new Object[] { eventId, revokedToken, realtimeNotifierTTL, expiryTimeForJWT, tokenType, tenantId };
EventPublisherEvent tokenRevocationEvent = new EventPublisherEvent(APIConstants.TOKEN_REVOCATION_STREAM_ID, System.currentTimeMillis(), objects);
APIUtil.publishEvent(EventPublisherType.TOKEN_REVOCATION, tokenRevocationEvent, tokenRevocationEvent.toString());
}
Aggregations