# Understanding uorb aspects (reading queued topics)

**URL:** <https://discuss.px4.io/t/understanding-uorb-aspects-reading-queued-topics/3767>\
**Category:** Uncategorized\
**Created:** [July 2, 2017, 10:34am UTC](https://discuss.px4.io/t/understanding-uorb-aspects-reading-queued-topics/3767 "2017-07-02T10:34:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukegluke](https://discuss.px4.io/user_avatar/discuss.px4.io/lukegluke/32/6216_2.png) [@lukegluke](https://discuss.px4.io/u/lukegluke)\
**Post date:** [July 2, 2017, 10:34am UTC](https://discuss.px4.io/t/understanding-uorb-aspects-reading-queued-topics/3767/1 "2017-07-02T10:34:37Z")

</div>

Hi all,

I’m trying to understand how to work with queued topics (that is advertised with **orb\_advertise\_queue** or **orb\_advertise\_multi\_queue** ) - how can I copy out several messages from queue?

For example, let say gps driver publishes to topic **gps\_dump** data of NMEA messages from 20Hz gps receiver. gps\_dump.msg data array is limited by 79 bytes, so messages are published in topic with higher then 20Hz rate. The size of queue of gps\_dump topic is 8.

Now my module subscribes on **gps\_dump** topic and limit polling rate to 20Hz. On every update I would like to read out all messages that are currently in the queue, something like this:

```
if (fds[0].revents & POLLIN) {
	struct gps_dump_s report;
	uint8_t buf[79*4]; //up to 4 reports
	ammountR = 0;
	bool updated = true;

	//accumulate several reports in one message
	do {
		orb_copy(ORB_ID(gps_dump), gps_dump_sub_fd, &report);
		memcpy(buf+ammountR, (uint8_t*)report.data, (uint8_t)report.len);
		ammountR += (uint8_t)report.len;
		orb_check(gps_dump_sub_fd, &updated);
	} while ((updated) && (ammountR < 79*3));
	...

```

but every time I read out only one 79 bytes long message. This leads to lost messages (according to uorb top -a)

Of course, I can uprate polling rate of my module and it works, but I didn’t understand why orb topics can be queued at all then? I think that I missed something.

Thanks in advance for help!
