use of org.wso2.carbon.apimgt.notification.NotificationEventService in project carbon-apimgt by wso2.
the class NotifyApiServiceImpl method notifyPost.
@Override
public Response notifyPost(String xWSO2KEYManager, String body, MessageContext messageContext) {
try {
NotificationEventService notificationEventService = (NotificationEventService) PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(NotificationEventService.class, new Hashtable<>());
Map<String, List<String>> requestHeaders = messageContext.getHttpHeaders().getRequestHeaders();
notificationEventService.processEvent(xWSO2KEYManager, body, requestHeaders);
return Response.ok().build();
} catch (APIManagementException e) {
log.error("Error while processing notification", e);
JSONObject responseObj = new JSONObject();
responseObj.put("Message", e.getMessage());
String responseStringObj = String.valueOf(responseObj);
return Response.serverError().entity(responseStringObj).build();
}
}
use of org.wso2.carbon.apimgt.notification.NotificationEventService in project carbon-apimgt by wso2.
the class ApimgtNotificationServiceComponent method activate.
@Activate
protected void activate(ComponentContext ctxt) {
ctxt.getBundleContext().registerService(KeyManagerEventHandler.class, new DefaultKeyManagerEventHandlerImpl(), null);
ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksSubscriptionEventHandler(), null);
ctxt.getBundleContext().registerService(EventHandler.class, new WebhooksDeliveryEventHandler(), null);
ctxt.getBundleContext().registerService(NotificationEventService.class, new NotificationEventService(), null);
}
Aggregations