Yes, it is possible.
The maximum length of a queue can be limited to a set number of messages by supplying the x-max-length queue declaration argument with a non-negative integer value.
AFAIK, pika's channel.queue_declare
has queue_declare has arguments
argument which is definitely what you want.