Universal Messaging 10.1 | Developer Guide | Enterprise APIs | Enterprise Developer's Guide for Python | Enterprise Client Development | Synchronously Requesting Events
 
Synchronously Requesting Events
Although in most circumstances it is more efficient to consume events asynchronously. The Universal Messaging Python API also provides the ability to request events one by one from the server.
Once you have created a session you can create an iterator for the channel or queue that you wish to consume from.

iter = NirvanaModule.getIterator(channame,startEid, selector,
timeout)
for evt in iter:
doSomething(evt)
On each iteration the Python client will request an event from the server and receive the event back as a response. Once the client has consumed all of the events on the channel/queue, it will wait for timeout milliseconds for another event to be received. When the client times out it will stop iterating.
Alternatively you can manually request events from the server:

evt = iter.next()
Once all events are consumed the next() method will time out and return None.