@Override protected void configureMuleContext(MuleContextBuilder builder) { super.configureMuleContext(builder); // Configure EndpointMessageNotificationListener for notifications test ServerNotificationManager notificationManager = new ServerNotificationManager(); notificationManager.addInterfaceToType( EndpointMessageNotificationListener.class, EndpointMessageNotification.class); notificationManager.addInterfaceToType( SecurityNotificationListener.class, SecurityNotification.class); builder.setNotificationManager(notificationManager); }
protected final void registerNotificationType( final ServerNotificationManager notificationManager, @SuppressWarnings("rawtypes") final Class<? extends ServerNotificationListener> listenerType, final Class<? extends ServerNotification> notificationType) { @SuppressWarnings("rawtypes") final Map<Class<? extends ServerNotificationListener>, Set<Class<? extends ServerNotification>>> mapping = notificationManager.getInterfaceToTypes(); if (!mapping.containsKey(listenerType)) { notificationManager.addInterfaceToType(listenerType, notificationType); } }