src/Producer.php
public function publish(string $message, string $routingKey, ?int $flags = null, $attributes = []): void
    {
        if ($this->closed) {
            throw new BadMethodCallException('This Producer object is closed and cannot send any more messages.');
        }
        $this->messages[] = [
            'message' => $message,
            'routingKey' => $routingKey,
            'flags' => $flags,
            'attributes' => $attributes,
        ];
    }
public function publish(string $message, string $routingKey, ?int $flags = null, $attributes = []): void
    {
        if ($this->closed) {
            throw new BadMethodCallException('This Producer object is closed and cannot send any more messages.');
        }
        $this->messages[] = [
            'message' => $message,
            'routingKey' => $routingKey,
            'flags' => $flags,
            'attributes' => $attributes,
        ];
    }
public function publish ( string $ message , string $ routingKey , ? int $ flags = null , $ attributes = [ ] ) : void { if ( $ this -> closed ) { throw new BadMethodCallException ( 'This Producer object is closed and cannot send any more messages.' ) ; } $ this -> messages [ ] = [ 'message' => $ message , 'routingKey' => $ routingKey , 'flags' => $ flags , 'attributes' => $ attributes , ] ; }
Method to publish a message to an AMQP exchange. Has the same method
signature as the exchange objects publish method.

@param string   $message    Message
@param string   $routingKey Routing key
@param int|null $flags      Flags
@param array    $attributes Attributes

@throws BadMethodCallException
Method to publish a message to an AMQP exchange . Has the same method signature as the exchange objects publish method .