code: @Override
      public void serviceChanged(ServiceEvent serviceEvent) {
          final String topic = getTopic(serviceEvent);
  
          // 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, serviceEvent);
  
          // "service" --> result of getServiceReference
          // "service.id" --> the service's ID
          // "service.pid" --> the service's persistent ID if not null
          // "service.objectClass" --> the services object class
          ServiceReference serviceReference = serviceEvent.getServiceReference();
          if (serviceReference != null) {
              eventProperties.put(EventConstants.SERVICE, serviceReference);
  
              Long serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
              eventProperties.put(EventConstants.SERVICE_ID, serviceId);
  
              Object servicePersistentId = serviceReference.getProperty(Constants.SERVICE_PID);
              if (servicePersistentId != null) {
                  // String[] must be coerced into Collection<String>
                  if (servicePersistentId instanceof String[]) {
                      servicePersistentId = Arrays.asList((String[]) servicePersistentId);
                  }
                  eventProperties.put(EventConstants.SERVICE_PID, servicePersistentId);
              }
  
              String[] objectClass = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
              if (objectClass != null) {
                  eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
              }
          }
  
          // Construct and fire the event
          Event event = new Event(topic, eventProperties);
          eventAdmin.postEvent(event);
      }
docs: Receive notification of a service lifecycle change event and adapt it to
  the format required for the <code>EventAdmin</code> service.
  
  @param serviceEvent
  the service lifecycle event to publish as an <code>Event</code>