A collector is used to register interest in events produced by one or more pn_connection_t objects. Collectors are not currently thread safe, so synchronization must be used if they are to be shared between multiple connection objects.

Once in a released state a collector will drain any internally queued events (thereby releasing any pointers they may hold), shrink it's memory footprint to a minimum, and discard any newly created events.

This operation will create a new event of the given type and context and return a pointer to the newly created event. In some cases an event of the given type and context can be elided. When this happens, this operation will return a NULL pointer.