'Emit RPC notifications to registered subscribers.'

@registry.receives(trunk_consts.TRUNK, [events.AFTER_CREATE, events.AFTER_DELETE])
@registry.receives(trunk_consts.SUBPORTS, [events.AFTER_CREATE, events.AFTER_DELETE])
def process_event(self, resource, event, trunk_plugin, payload):

    context = payload.context
    LOG.debug('RPC    notification    needed    for    trunk    %s', payload.trunk_id)
    if (resource == trunk_consts.SUBPORTS):
        payload = payload.subports
        method = {events.AFTER_CREATE: self._stub.subports_added, events.AFTER_DELETE: self._stub.subports_deleted}
    elif (resource == trunk_consts.TRUNK):
        payload = (payload.current_trunk or payload.original_trunk)
        method = {events.AFTER_CREATE: self._stub.trunk_created, events.AFTER_DELETE: self._stub.trunk_deleted}
    LOG.debug('Emitting    event    %s    for    resource    %s', event, resource)
    method[event](context, payload)
