Reference: Paging and message selectors
24.7. Paging and message selectors Note Please note that message selectors will only operate on messages in memory. If you have a large amount of messages paged to disk and a selector that only matches some of the paged messages, then those messages won't be consumed until the messages in memory have been consumed. HornetQ does not scan through page files on disk to locate matching messages. To do this efficiently would mean implementing and managing indexes amongst other things. Effectively we would be writing a relational database! This is not the primary role of a messaging system. If you find yourself using selectors which only select small subsets of messages in very large queues which are too large to fit in memory at any one time, then you probably want a relational database not a messaging system - you're effectively executing queries over tables.