public function attach(MessageInterface $message)
    {

        // force handling the timer tasks now
        $this->synchronized(function (MessageQueue $self, MessageInterface $m) {
            // create a unique identifier for the priority
            $priority = $this->uniqueWorkerName($m->getPriority());

            // load the worker for the message's priority
            if (isset($self->workers[$priority])) {
                // attach the message
                $self->messages[$m->getMessageId()] = $m;

                // store the job-ID and the PK of the message => necessary to load the message later
                $jobWrapper = new \stdClass();
                $jobWrapper->jobId = $m->getMessageId();
                $jobWrapper->messageId = $m->getMessageId();

                // attach the job to the worker
                $self->workers[$priority]->attach($jobWrapper);
            }

        }, $this, $message);
    }
public function attach(MessageInterface $message)
    {

        // force handling the timer tasks now
        $this->synchronized(function (MessageQueue $self, MessageInterface $m) {
            // create a unique identifier for the priority
            $priority = $this->uniqueWorkerName($m->getPriority());

            // load the worker for the message's priority
            if (isset($self->workers[$priority])) {
                // attach the message
                $self->messages[$m->getMessageId()] = $m;

                // store the job-ID and the PK of the message => necessary to load the message later
                $jobWrapper = new \stdClass();
                $jobWrapper->jobId = $m->getMessageId();
                $jobWrapper->messageId = $m->getMessageId();

                // attach the job to the worker
                $self->workers[$priority]->attach($jobWrapper);
            }

        }, $this, $message);
    }
public function attach ( MessageInterface $ message ) { // force handling the timer tasks now $ this -> synchronized ( function ( MessageQueue $ self , MessageInterface $ m ) { // create a unique identifier for the priority $ priority = $ this -> uniqueWorkerName ( $ m -> getPriority ( ) ) ; // load the worker for the message's priority if ( isset ( $ self -> workers [ $ priority ] ) ) { // attach the message $ self -> messages [ $ m -> getMessageId ( ) ] = $ m ; // store the job-ID and the PK of the message => necessary to load the message later $ jobWrapper = new \ stdClass ( ) ; $ jobWrapper -> jobId = $ m -> getMessageId ( ) ; $ jobWrapper -> messageId = $ m -> getMessageId ( ) ; // attach the job to the worker $ self -> workers [ $ priority ] -> attach ( $ jobWrapper ) ; } } , $ this , $ message ) ; }
Attach a new message to the queue.

@param \AppserverIo\Psr\Pms\MessageInterface $message The messsage to be attached to the queue

@return void
Attach a new message to the queue .