* @return
* @throws Exception
*/
@Override
public MessageProducerResources doCreateProducerModel() throws Exception {
MessageProducerResources answer = null;
Connection conn = null;
try {
conn = getConnectionResource().borrowConnection();
TransactionCommitStrategy commitStrategy = null;
Session session;
if (isEndpointTransacted()) {
if (getCommitStrategy() != null) {
commitStrategy = getCommitStrategy();
} else {
commitStrategy = new DefaultTransactionCommitStrategy();
}
session = conn.createSession(true, getAcknowledgeMode());
} else {
session = conn.createSession(false, getAcknowledgeMode());
}
MessageProducer messageProducer = JmsObjectFactory.createMessageProducer(session, getDestinationName(), isTopic(), isPersistent(), getTtl());
answer = new MessageProducerResources(session, messageProducer, commitStrategy);
} catch (Exception e) {
log.error("Unable to create the MessageProducer: " + e.getLocalizedMessage());
} finally {
if (conn != null) {
getConnectionResource().returnConnection(conn);