Have you found/read this documentation?: http://qpid.apache.org/releases/qpid-proton-0.4/protocol-engine/python/api/proton.Data-class.html
It's for the python binding to the API, but the background it gives should be useful for understanding the model behind the C API as well. I believe all you would need to do to generalize your code to handle arbitrary AMQP data is to extend the switch statement to cover the full range of AMQP types present in the pn_type_t. (You should be able to find the full list in the documentation link above.) Note that enter/exit are only used for entering and exiting composite data types, i.e. map, list, and described types. The code you have for the string case of your switch statement doesn't make sense as you are trying to "enter" a string, however a string is a leaf node value. The call to enter won't make a difference there, it will simply fail and return false, however the call to next and exit will mess up the position of the cursor within the data tree, pushing you ahead by one and then popping you up a level. Hope this helps, if it's still not clear, please follow up and I'll put together a proper example for you. --Rafael On Tue, Jul 23, 2013 at 5:52 PM, amqp1 <[email protected]> wrote: > I know how to fix that particular problem in my snippet of code, I just > need > to remove pn_data_enter(body); and pn_data_next(body); and > pn_data_exit(body); since that "field" is at the top level of the message. > > My query is more about how to do it for all types, map, list, etc. in the > general case for any arbitrary received message. > > I also saw pn_data_scan, but I read somewhere on this list it is type-safe > or something to that effect. > > > > > -- > View this message in context: > http://qpid.2158936.n2.nabble.com/Using-Qpid-Proton-0-4-to-iterate-over-arbitrary-AMQP-message-tp7595828p7595844.html > Sent from the Apache Qpid users mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
