Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish
to all interested subscribers.
437374
void processPubRel(String clientID, int messageID) {
        Log.trace("PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}", clientID, messageID);
        String publishKey = String.format("%s%d", clientID, messageID);
        PublishEvent evt = m_storageService.retrieveQoS2Message(publishKey);

        final String topic = evt.getTopic();
        final AbstractMessage.QOSType qos = evt.getQos();

        publish2Subscribers(topic, qos, evt.getMessage(), evt.isRetain(), evt.getMessageID());

        m_storageService.removeQoS2Message(publishKey);

        if (evt.isRetain()) {
            m_storageService.storeRetained(topic, evt.getMessage(), qos);
        }

        sendPubComp(clientID, messageID);
    }
132499
def send(self, message_data, delivery_mode=None):
        """"""
        self.publisher.send(message_data, delivery_mode=delivery_mode)
1125184
def publish(self, topic, payload, qos, retain):
        """"""
        self._mqttc.publish(topic, payload, qos, retain)
1220978
def multipublish(self, topic, messages):
        
        self.send(nsq.multipublish(topic, messages))
330498
def publish(self, topic, payload = None, qos = 0, retain = False):
        """"""
        #print "PUBLISHING (",topic,"): ", payload
        payloadlen = len(payload)
        if topic is None or qos < 0 or qos > 2:
            print "PUBLISH:err inval"
            return NC.ERR_INVAL
        
        #payloadlen <= 250MB
        if payloadlen > (250 * 1024 * 1204):
            self.logger.error("PUBLISH:err payload len:%d", payloadlen)
            return NC.ERR_PAYLOAD_SIZE
        
        #wildcard check : TODO
        mid = self.mid_generate()
        
        if qos in (0,1,2):
            return self.send_publish(mid, topic, payload, qos, retain, False)

        else:
            self.logger.error("Unsupport QoS= %d", qos)
    
        return NC.ERR_NOT_SUPPORTED
358832
def multipublish_http(self, topic, messages, **kwargs):
        
        return self.__http_client.multipublish(topic, messages, **kwargs)
888083
function (client, backlog, channel, message) {
    if ( addToBacklog(client, backlog, publishBrowser, [client, backlog, channel, message]) ) return;
    message = new mqtt_lib.Message(message);
    message.destinationName = channel;
    client.send(message);
}
71196
def publish(message_name, data=nil, opts={})
      message_name = validated_message_name(message_name)
      publisher.publish(message_name, data, opts)
    end
478039
final PublishResponse publish(
      ProjectTopicName topic, List<PubsubMessage> messages) {

    PublishRequest request =
        PublishRequest.newBuilder()
            .setTopic(topic == null ? null : topic.toString())
            .addAllMessages(messages)
            .build();
    return publish(request);
  }
838259
def pub(self, topic, message):
        ''''''
        return self.send(' '.join((constants.PUB, topic)), message)
698674
def do_publish(broker, cmd, f, when, res, meta, *args, **kwargs):
    
    publish_command = functools.partial(
        broker.publish,
        topic=command_types.COMMAND)
    call_args = _get_args(f, args, kwargs)
    if when == 'before':
        broker.logger.info("{}: {}".format(
            f.__qualname__,
            {k: v for k, v in call_args.items() if str(k) != 'self'}))
    command_args = dict(
        zip(
            reversed(inspect.getfullargspec(cmd).args),
            reversed(inspect.getfullargspec(cmd).defaults
                     or [])))

    # TODO (artyom, 20170927): we are doing this to be able to use
    # the decorator in Instrument class methods, in which case
    # self is effectively an instrument.
    # To narrow the scope of this hack, we are checking if the
    # command is expecting instrument first.
    if 'instrument' in inspect.getfullargspec(cmd).args:
        # We are also checking if call arguments have 'self' and
        # don't have instruments specified, in which case
        # instruments should take precedence.
        if 'self' in call_args and 'instrument' not in call_args:
            call_args['instrument'] = call_args['self']

    command_args.update({
        key: call_args[key]
        for key in
        (set(inspect.getfullargspec(cmd).args)
         & call_args.keys())
    })

    if meta:
        command_args['meta'] = meta

    payload = cmd(**command_args)

    message = {**payload, '$': when}
    if when == 'after':
        message['return'] = res
    publish_command(
        message={**payload, '$': when})
611656
def publish
      publisher.publish('instance', added: info) do |redis|
        redis.setex "instance_#{ @id }", Attention.options[:ttl], JSON.dump(info)
      end
      heartbeat
    end
1266989
def publish_event(self, channel, event, message):
        '''
        '''
        assert self.protocol is not None, "Protocol required"
        msg = {'event': event, 'channel': channel}
        if message:
            msg['data'] = message
        return self.publish(channel, msg)
949189
def _publish(self, msg):
        
        connection = self._connection.clone()
        publish = connection.ensure(self.producer, self.producer.publish,
                                    errback=self.__error_callback,
                                    max_retries=MQ_PRODUCER_MAX_RETRIES)
        publish(json.dumps(msg), exchange=self._exchange,
                routing_key=self._routing_key, declare=[self._queue])
        logging.debug('Publisher: message sent: %s', msg)
252385
function publish(conn, channel, message) {
  var c = 0
    , indices = []
    , len
    , k
    , re;

  // exact channel match
  for(k in this._channels) {
    // found the channel
    if(k === channel) {
      indices = this._channels[k].slice(0);
      this.emit(
        PUBSUB.PUBLISH, conn, channel, indices,
          [PUBSUB.MESSAGE, channel, message]);
      break;
    }
  }

  len = indices.length;

  // reset indices for patterns
  // required to prevent channel subscribers
  // from also receiving pmessage events
  indices = [];

  // test against pattern channels
  for(k in this._patterns) {
    // pattern should be pre-compiled
    re = this._patterns[k].re;
    if(re.test(channel)) {
      indices = indices.concat(this._patterns[k]);
      this.emit(
        PUBSUB.PUBLISH, conn, channel, indices,
          [PUBSUB.PMESSAGE, k, channel, message]);
    }
  }

  len += indices.length;

  return len;
}
378668
def publish(self, msg):
        '''
        
        '''
        if not self.streams:
            return

        pack = salt.transport.frame.frame_msg_ipc(msg, raw_body=True)

        for stream in self.streams:
            self.io_loop.spawn_callback(self._write, stream, pack)
1005448
def _publish_connection(self, name=None):
        
        try:
            conn = self._connections[name or self._message.connection]
        except KeyError:
            raise ValueError('Channel {} not found'.format(name))
        if not conn.is_connected or conn.channel.is_closed:
            raise RabbitMQException(conn.name, 599, 'NOT_CONNECTED')
        return conn