code: def _monitor_events(self):
          
          LOG.info("Starting to monitor PB events")
          check_counter = 0
          while True:
              if check_counter == 50:
                  check_counter = 0
                  LOG.debug('Checking for PB events...')
  
              published_events = self._pb_events.get_published_events()
              for event in published_events:
                  if event.type == 'status_changed':
                      LOG.info('PB status changed event: %s',
                               event.data['status'])
  
                      if event.data['status'] == 'created':
                          LOG.info('Acknowledged PB created event (%s) for %s, '
                                   '[timestamp: %s]', event.id,
                                   event.object_id, event.timestamp)
                          pb = ProcessingBlock(event.object_id)
                          self._queue.put(event.object_id, pb.priority, pb.type)
  
                      if event.data['status'] == 'completed':
                          LOG.info('Acknowledged PB completed event (%s) for %s,'
                                   ' [timestamp: %s]', event.id,
                                   event.object_id, event.timestamp)
                          self._num_pbcs -= 1
                          if self._num_pbcs < 0:
                              self._num_pbcs = 0
  
              time.sleep(0.1)
              check_counter += 1
docs: Watch for Processing Block events.