This approach is perfectly valid for this situation (when the remote endpoint is not always available) and is known as "store-and-forward" messaging. In fact, many application servers support this out of the box, for example WebLogic and his Store and Forward service:
The SAF service enables WebLogic Server to deliver messages reliably between applications that are distributed across WebLogic Server instances. For example, with the SAF service, an application that runs on or connects to a local WebLogic Server instance can reliably send messages to an endpoint that resides on a remote server. If the destination is not available at the moment the messages are sent, either because of network problems or system failures, then the messages are saved on a local server instance, and are forwarded to the remote endpoint once it becomes available.
In the case of Open MQ (GlassFish's JMS implementation), I known that Store and Forward messaging was on the features plans (see this presentation from 2007). But I have some difficulties to find an exact status on this (messages like this one don't really clarify the situation). What is sure is that GlassFish v3 uses Open MQ 4.4 and Open MQ 4.4 has JMS bridge (which is required for store and forward) and you may be able to use it for broker to broker communication. See this recent blog post on how to configure it (couldn't find the documentation of Open MQ 4.4!!). Personally, I'd post a message on the dev mailing list.
Now, if this isn't really clear, or if you don't get a satisfying answer, it's always possible to write a custom application to consume messages and forward them to a different broker and it is not that complicated. Basically, store and forward messaging means using a "local" persistent queue for the application and using a MDB to consume the messages and send them to the remote JMS destination (in a single transaction). This would require some further testing but, as a JMS client, the MDB that handles the forwarding should be able to reconnect transparently to the remote destination.