code: public void frameworkEvent(FrameworkEvent frameworkEvent) {
          final String topic = getTopic(frameworkEvent);
  
          // Bail quickly if the event is one that should be ignored
          if (topic == null) {
              return;
          }
  
          // Event properties
          Map<String, Object> eventProperties = new HashMap<String, Object>();
  
          // "event" --> the original event object
          eventProperties.put(EventConstants.EVENT, frameworkEvent);
  
          // Non-null result from getBundle
          // "bundle.id" --> source bundle id as Long
          // "bundle.symbolicName" --> source bundle's symbolic name
          // "bundle" --> the source bundle object
          Bundle bundle = frameworkEvent.getBundle();
          if (bundle != null) {
              eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId()));
              String symbolicName = bundle.getSymbolicName();
              if (symbolicName != null) {
                  eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName);
              }
              eventProperties.put(EventConstants.BUNDLE, bundle);
          }
  
          // Non-null result from getThrowable
          // "exception.class" --> fully-qualified class name of attached exception
          // "exception.message" --> the message from the attached exception
          // "exception" --> the Throwable associated with the event
          Throwable throwable = frameworkEvent.getThrowable();
          if (throwable != null) {
              eventProperties.put(EventConstants.EXCEPTION_CLASS, throwable.getClass().getName());
              String message = throwable.getMessage();
              if (message != null) {
                  eventProperties.put(EventConstants.EXCEPTION_MESSAGE, message);
              }
              eventProperties.put(EventConstants.EXCEPTION, throwable);
          }
  
          // Construct and fire the event
          Event event = new Event(topic, eventProperties);
          eventAdmin.postEvent(event);
      }
docs: Receive notification of a framework event and adapt it to the format
  required for the <code>EventAdmin</code> service.
  
  @param frameworkEvent
  the framework event to publish as an <code>Event</code>