Stomp::__destruct

stomp_close

(PECL stomp >= 0.1.0)

Stomp::__destruct -- stomp_closeCloses stomp connection

Description

Object oriented style (destructor):

public bool Stomp::__destruct ( void )

Procedural style:

bool stomp_close ( resource $link )

Closes a previously opened connection.

Parameters

link

Procedural style only: The stomp link identifier returned by stomp_connect().

Return Values

Returns TRUE on success or FALSE on failure.

Examples

See stomp_connect().

Коментарии

Isn't it a little odd to have connect/disconnect in the constructor/destructor methods? 
I have a case where the connection is presumably kept alive until the PHP process ends:

<?php
class MyStompWrapper {
    public function 
doSend()
    {
       
$stomp $this->connect(); // returns Stomp Object
       
$stomp->send('/destination''message', []);
       
$this->disconnect($stomp);
       
// $stomp still exists in this scope, hence, the connection is alive
   
}

    private function 
disconnect(\Stomp $stompObj)
    {
       
// only unsets the local $stomp pointer, does not actually disconnect
       
unset($stomp);
    }

    private function 
connect():\Stomp
   
{
       
// try-catch block omitted for example brevity
       
return new Stomp('url''username''password');
    }
}
?>

This means that, in order to handle disconnecting, I have to create and destroy the Stomp object within the same scope.
2018-10-29 18:11:57
http://php5.kiev.ua/manual/ru/stomp.destruct.html

    Поддержать сайт на родительском проекте КГБ