Publish a message to a named exchange.
18164
def publish(self, message, exchange, routing_key, mandatory=None,
            immediate=None, headers=None):
        """"""
        body, properties = message

        if headers:
            properties.headers = headers

        ret = self.channel.basic_publish(body=body,
                                         properties=properties,
                                         exchange=exchange,
                                         routing_key=routing_key,
                                         mandatory=mandatory,
                                         immediate=immediate)
        if mandatory or immediate:
            self.close()
239701
function publishCachedMessages() {
    if (_cachedPublishMessages.length > 0) {
      async.each(_cachedPublishMessages, function(message, callback) {
        debug('republish message', message);
        self.publishTopic(message.exchange, message.topic, message.message, message.options, function(err) {
          if (err) {
            debug('Failed to republish message', message);
          } else {
            var idx = _cachedPublishMessages.indexOf(message);
            _cachedPublishMessages.splice(idx, 1);
            debug('cached publish message re-published, now there are ' + _cachedPublishMessages.length + ' messages left');
          }
          return callback();
        });
      }, function() {
        debug('cached publish messages processed');
      });
    }
  }
751579
def publish(self, msg):
        
        self.pub.send("{} {}".format(self.name, msg))
        log.debug('Published message from {}'.format(self))
756035
def publish(self, message, channel=None):
        
        if not self.master:
            return
        channel = channel or ''
        data = json.dumps(message)
        self.publisher.send_string("%s %s" % (channel, data))
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;
}
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
1282842
def publish_message(self, message, client):
        
        return client.execute_command('publish', {
            'topic': self.data['transport']['topic'],
            'body': {
                'messages': {
                    'data': self.pack(message)
                }
            }
        })
336708
function publish(topic, msg) {
  if (!topic || !msg || typeof topic !== 'string' || typeof msg !== 'object') {
    throw new Error('A `topic` (string) and `msg` (object) property must be defined');
  }

  if (module.exports.client && BUS_MODULE) {
    module.exports.client.publish(`${NAMESPACE}:${topic}`, msg);
  } else if (module.exports.client) {
    module.exports.client.publish(`${NAMESPACE}:${topic}`, JSON.stringify(msg));
  }
}
1236811
def publish(self, rawtx):
        """"""
        tx = deserialize.signedtx(rawtx)
        if not self.dryrun:
            self.service.send_tx(tx)
        return serialize.txid(tx.hash())
814005
def publish(self, channel, message):
        
        if self.cfg.jsonpickle:
            message = jsonpickle.encode(message)
        return self.conn.publish(channel, message)
441480
def publish(self, tag, message):
        
        payload = self.build_payload(tag, message)
        self.socket.send(payload)
493068
def publish(self, json_msg):
        '''
        
        '''
        pyobj = json.loads(json_msg)
        for topic, value in pyobj.items():
            msg = '{topic} {data}'.format(topic=topic, data=json.dumps(value))
            self._pub.publish(msg)
1245985
def publish(self, topic, dct):
        
        get_logger().info("Publishing message {} on routing key "
                          "{}...".format(dct, topic))

        self._channel.basic_publish(
            exchange=self.exchange,
            routing_key=topic,
            body=json.dumps(dct)
        )
35637
public static String buildExchangeName( MessagingContext ctx ) {

		String exchangeName;
		if( ctx.getKind() == RecipientKind.DM )
			exchangeName = buildExchangeNameForTheDm( ctx.getDomain());
		else if( ctx.getKind() == RecipientKind.INTER_APP )
			exchangeName = buildExchangeNameForInterApp( ctx.getDomain());
		else
			exchangeName = RabbitMqUtils.buildExchangeNameForAgent( ctx.getDomain(), ctx.getApplicationName());

		return exchangeName;
	}
45900
def Publish(self, event_name, msg, delay=0):
    """"""
    events_lib.Events.PublishEvent(event_name, msg, delay=delay)
32247
public void publish(byte[] message, EventBus bus) {
        bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
    }
822731
public function basic_publish(
        $msg,
        $exchange = '',
        $routing_key = '',
        $mandatory = false,
        $immediate = false,
        $ticket = null
    ) {
        $pkt = new AMQPWriter();
        $pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket));

        try {
            $this->connection->send_content(
                $this->channel_id,
                60,
                0,
                mb_strlen($msg->body, 'ASCII'),
                $msg->serialize_properties(),
                $msg->body,
                $pkt
            );
        } catch (AMQPConnectionClosedException $e) {
            $this->do_close();
            throw $e;
        }

        if ($this->next_delivery_tag > 0) {
            $this->published_messages[$this->next_delivery_tag] = $msg;
            $this->next_delivery_tag = bcadd($this->next_delivery_tag, '1', 0);
        }
    }