I think 1 million messages in one transaction is too big.
Maybe you can make your messages more compact to save memory. For example you can pack every 1000 numbers into one message, so you reduce the message number to about 1000 messages per transaction.
The problem is that whole system is designed in the way that MDB that consumes messages from queue can operate only operate on one number from message. Because logic in MDB have a lot to do and also is transactional i can't put many numbers in one message. I have a walkaround solution but I'am searching for something that could help me to go without it.