Assuming you have a JmsSession to send the messages, you can do jmsSession.commit()
and jmsSession.rollback()
to complete the jms transaction.
If you want the messages to be persistent, i.e. they can be delivered after jms server crash, you can set the delivery mode of the message to be persistent: jmsMessageProducer.send(msg, DeliveryMode.PERSITENT)
See this for details: