use of org.wso2.carbon.apimgt.eventing.EventPublisherEvent in project carbon-apimgt by wso2.
the class APIProviderImpl method publishKeyTemplateEvent.
private void publishKeyTemplateEvent(String templateValue, String state) {
Object[] objects = new Object[] { templateValue, state };
Event keyTemplateMessage = new Event(APIConstants.KEY_TEMPLATE_STREM_ID, System.currentTimeMillis(), null, null, objects);
ThrottleProperties throttleProperties = getAPIManagerConfiguration().getThrottleProperties();
EventPublisherEvent keyTemplateEvent = new EventPublisherEvent(APIConstants.KEY_TEMPLATE_STREM_ID, System.currentTimeMillis(), objects, keyTemplateMessage.toString());
APIUtil.publishEvent(EventPublisherType.KEY_TEMPLATE, keyTemplateEvent, keyTemplateMessage.toString());
}
use of org.wso2.carbon.apimgt.eventing.EventPublisherEvent in project carbon-apimgt by wso2.
the class WebhooksSubscriptionEventHandler method sendSubscriptionNotificationOnRealtime.
/**
* Method to publish the subscription request on to the realtime message broker
*
* @param event realtime notification data read from the event
*/
private void sendSubscriptionNotificationOnRealtime(WebhooksSubscriptionEvent event, boolean isSuccess) {
Object[] objects = new Object[] { event.getApiUUID(), event.getApiName(), event.getApiContext(), event.getApiVersion(), event.getAppID(), event.getTenantDomain(), event.getTenantId(), event.getCallback(), event.getTopic(), event.getMode(), event.getSecret(), event.getExpiryTime(), event.getSubscriberName(), event.getApplicationTier(), event.getTier(), event.getApiTier(), !isSuccess };
EventPublisherEvent asyncWebhooksEvent = new EventPublisherEvent(APIConstants.WEBHOOKS_SUBSCRIPTION_STREAM_ID, System.currentTimeMillis(), objects);
APIUtil.publishEvent(EventPublisherType.ASYNC_WEBHOOKS, asyncWebhooksEvent, asyncWebhooksEvent.toString());
}
use of org.wso2.carbon.apimgt.eventing.EventPublisherEvent in project carbon-apimgt by wso2.
the class KeyMgtNotificationSender method notify.
public void notify(KeyManagerConfigurationDTO keyManagerConfigurationDTO, String action) {
String encodedString = "";
if (keyManagerConfigurationDTO.getAdditionalProperties() != null) {
String additionalProperties = new Gson().toJson(keyManagerConfigurationDTO.getAdditionalProperties());
encodedString = new String(Base64.encodeBase64(additionalProperties.getBytes()));
}
Object[] objects = new Object[] { APIConstants.KeyManager.KeyManagerEvent.KEY_MANAGER_CONFIGURATION, action, keyManagerConfigurationDTO.getName(), keyManagerConfigurationDTO.getType(), keyManagerConfigurationDTO.isEnabled(), encodedString, keyManagerConfigurationDTO.getOrganization(), keyManagerConfigurationDTO.getTokenType() };
Event keyManagerEvent = new Event(APIConstants.KeyManager.KeyManagerEvent.KEY_MANAGER_STREAM_ID, System.currentTimeMillis(), null, null, objects);
EventHubConfigurationDto eventHubConfigurationDto = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration().getEventHubConfigurationDto();
if (eventHubConfigurationDto.isEnabled()) {
EventPublisherEvent notificationEvent = new EventPublisherEvent(APIConstants.KeyManager.KeyManagerEvent.KEY_MANAGER_STREAM_ID, System.currentTimeMillis(), objects, keyManagerEvent.toString());
APIUtil.publishEvent(EventPublisherType.KEYMGT_EVENT, notificationEvent, keyManagerEvent.toString());
}
}
use of org.wso2.carbon.apimgt.eventing.EventPublisherEvent in project carbon-apimgt by wso2.
the class APIAuthenticationAdminClient method publishEvent.
/**
* Publishes events through event publisher
*
* @param objectData - The event payload data.
*/
private void publishEvent(Object[] objectData) {
EventPublisherEvent cacheInvalidationEvent = new EventPublisherEvent(APIConstants.CACHE_INVALIDATION_STREAM_ID, System.currentTimeMillis(), objectData);
APIUtil.publishEvent(EventPublisherType.CACHE_INVALIDATION, cacheInvalidationEvent, cacheInvalidationEvent.toString());
}
use of org.wso2.carbon.apimgt.eventing.EventPublisherEvent in project carbon-apimgt by wso2.
the class AbstractNotifier method publishEventToEventHub.
protected void publishEventToEventHub(Event event) {
byte[] bytesEncoded = Base64.encodeBase64(new Gson().toJson(event).getBytes());
Object[] objects = new Object[] { event.getType(), event.getTimeStamp(), new String(bytesEncoded) };
// Decoded event string to be logged in the case of failures and debugging
String loggingEvent = event.toString();
EventPublisherEvent notificationEvent = new EventPublisherEvent(APIConstants.NOTIFICATION_STREAM_ID, System.currentTimeMillis(), objects, loggingEvent);
APIUtil.publishEvent(EventPublisherType.NOTIFICATION, notificationEvent, loggingEvent);
}
Aggregations