I have find how to do it
public void commit(JmsTemplate jmsTemplate) {
jmsTemplate.execute((SessionCallback<Void>) session -> {
try {
JmsUtils.commitIfNecessary(session);
} catch (JMSException e) {
log.warn("Sending to MQ failed");
}
return null;
});
}