Women in Technology

Hear us Roar



Article:
  How to Use JMS with PHP
Subject:   phpmq
Date:   2004-11-02 09:41:18
From:   simbo

what happens in the example when the queue is empty?


what is the behaviour of the topic based php methods? does getMessageFromTopic block until the number of messages specified to subscribe have been picked up?

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Amir Shevat photo phpmq
    2004-11-02 10:47:00  Amir Shevat | O'Reilly Blogger [View]

    In general all PHPMQ messaging methods are non blocking.

    The example assumes that the queue has elements in it ready to be dequeued, the dequeue will return null if empty. In the real world there should be a default value (i.e. "./myAdd.gif") set when dequeue returns null.

    As for the second question - calling subscribe adds a listener that gathers messages up to, but no more than $messagesToCash. Calling the getMessageFromTopic($userKey, $topicName) returns all the messages gathered by that listener (empty array if non gathered).



    I found that using non blocking methods caused less problems when running the PHP scripts. Do you think there is a need for blocking methods in addition to the non blocking?