use of org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent in project carbon-apimgt by wso2.
the class ExternalGatewayNotifier method process.
/**
* Process gateway notifier events related to External gateway deployments
*
* @param event related to deployments
* @throws NotifierException if error occurs when casting event
*/
private void process(Event event) throws NotifierException {
DeployAPIInGatewayEvent deployAPIInGatewayEvent;
deployAPIInGatewayEvent = (DeployAPIInGatewayEvent) event;
if (isExternalGatewayAvailableToDeployment(deployAPIInGatewayEvent))
if (APIConstants.EventType.DEPLOY_API_IN_GATEWAY.name().equals(event.getType())) {
deployApi(deployAPIInGatewayEvent);
} else if (APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name().equals(event.getType())) {
unDeployApi(deployAPIInGatewayEvent);
}
}
use of org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent in project carbon-apimgt by wso2.
the class APIGatewayManager method sendUnDeploymentEvent.
private void sendUnDeploymentEvent(API api, String tenantDomain, Set<String> removedGateways) {
APIIdentifier apiIdentifier = api.getId();
DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name(), api.getOrganization(), api.getId().getId(), api.getUuid(), removedGateways, apiIdentifier.getName(), apiIdentifier.getVersion(), apiIdentifier.getProviderName(), api.getType(), api.getContext());
APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
}
use of org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent in project carbon-apimgt by wso2.
the class APIGatewayManager method sendUnDeploymentEvent.
private void sendUnDeploymentEvent(APIProduct apiProduct, String tenantDomain, Set<String> removedGateways, Set<API> associatedAPIs) {
APIProductIdentifier apiProductIdentifier = apiProduct.getId();
Set<APIEvent> apiEvents = transformAPIToAPIEvent(associatedAPIs);
DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name(), tenantDomain, apiProduct.getProductId(), apiProduct.getUuid(), removedGateways, apiProductIdentifier.getName(), apiProductIdentifier.getVersion(), PRODUCT_PREFIX, APIConstants.API_PRODUCT, apiProduct.getContext(), apiEvents);
APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
}
use of org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent in project carbon-apimgt by wso2.
the class APIGatewayManager method sendDeploymentEvent.
private void sendDeploymentEvent(APIProduct api, String tenantDomain, Set<String> publishedGateways) {
APIProductIdentifier apiIdentifier = api.getId();
DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.DEPLOY_API_IN_GATEWAY.name(), tenantDomain, api.getProductId(), api.getUuid(), publishedGateways, apiIdentifier.getName(), apiIdentifier.getVersion(), PRODUCT_PREFIX, api.getType(), api.getContext());
APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
if (debugEnabled) {
log.debug("Event sent to Gateway with eventID " + deployAPIInGatewayEvent.getEventId() + " for api " + "with apiID " + api + " at " + deployAPIInGatewayEvent.getTimeStamp());
}
}
Aggregations