It's certainly possible, assuming you are flexible about what happens to the elements that get to the front of the queue that don't match your criteria.
One simple way would be something like
while (true) {
Message message = blockingQueue.take();
if ( !message.author.equals(expectedAuthor) ) {
continue;
}
}
Now if you were wondering if you could cherry-pick elements from the queue, leaving the other elements in place, then no that is not possible with the queue datatype. You could make it work with some kind of Deque (double-ended queue), where you put the elements you don't care about in a temporary stack and then reinsert them back in when you find one you want. But you're definitely best to just use a separate queue that only contains the elements you care about.
For instance, you could have a thread that consumes every message in the queue and then redispatches it to a more specific queue:
Map<String, BlockingQueue<Message>> authorQueues;
BlockingQueue<Message> allMessages;
while(true) {
Message nextMessage = allMessages.take();
authorQueues.get(nextMessage.getAuthor()).put(nextMessage);
}
Then set up your consumer to consume the correct author queue.