ConnectionInterface.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Queue
  17. * @subpackage Stomp
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id: Stomp.php 14504 2009-03-27 05:32:18Z danlo $
  21. */
  22. /**
  23. * The Stomp client interacts with a Stomp server.
  24. *
  25. * @category Zend
  26. * @package Zend_Queue
  27. * @subpackage Stomp
  28. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. */
  31. interface Zend_Queue_Stomp_Client_ConnectionInterface
  32. {
  33. /**
  34. * @param string $scheme ['tcp', 'udp']
  35. * @param string host
  36. * @param integer port
  37. * @param string class - create a connection with this class; class must support Zend_Queue_Stomp_Client_Connection_Interface
  38. * @return boolean
  39. */
  40. public function open($scheme, $host, $port);
  41. /**
  42. * @param boolean $destructor
  43. * @return void
  44. */
  45. public function close($destructor = false);
  46. /**
  47. * Check whether we are connected to the server
  48. *
  49. * @return true
  50. * @throws Zend_Queue_Exception
  51. */
  52. public function ping();
  53. /**
  54. * write a frame to the stomp server
  55. * $response = $client->write($frame)->read();
  56. *
  57. * @param Zend_Queue_Stomp_FrameInterface $frame
  58. * @return $this
  59. */
  60. public function write(Zend_Queue_Stomp_FrameInterface $frame);
  61. /**
  62. * tests the socket to see if there is data for us
  63. */
  64. public function canRead();
  65. /**
  66. * reads in a frame from the socket or returns false.
  67. *
  68. * @return Zend_Queue_Stomp_Frame|false
  69. * @throws Zend_Queue_Exception
  70. */
  71. public function read();
  72. /**
  73. * Set the frame class to be used
  74. *
  75. * This must be a Zend_Queue_Stomp_FrameInterface.
  76. *
  77. * @param string $class
  78. * @return Zend_Queue_Stomp_Client_ConnectionInterface;
  79. */
  80. public function setFrameClass($class);
  81. /**
  82. * Get the frameClass
  83. *
  84. * @return string
  85. */
  86. public function getFrameClass();
  87. /**
  88. * create an empty frame
  89. *
  90. * @return Zend_Queue_Stomp_FrameInterface class
  91. */
  92. public function createFrame();
  93. }