Yes, this is possible. We developed modules to connect to RabbitMQ and to connect to Amazon MQ. There are Java libraries available to handle all the hard stuff, but you still need to write some glue code in Java to connect your Mendix app to the library. Depending on your JMS implementation, you may need a specific client library.
I have searched the AppStore, but I was unable to find any module that would cover this requirement. Currently, I think the closest thing in the AppStore is the Kafka module. It was created by Mendix, even though it only has community support, but I have used that module in some project and it worked pretty well. This would save you from writing Java code, but it requires you to host a Kafka cluster or acquire a managed Kafka cluster.