SWS-473
This commit is contained in:
@@ -148,6 +148,7 @@ public class JmsMessageSender extends JmsDestinationAccessor implements WebServi
|
||||
wsConnection.setResponseDestination(resolveResponseDestination(jmsSession, uri));
|
||||
wsConnection.setTimeToLive(JmsTransportUtils.getTimeToLive(uri));
|
||||
wsConnection.setTextMessageEncoding(textMessageEncoding);
|
||||
wsConnection.setSessionTransacted(isSessionTransacted());
|
||||
wsConnection.setPostProcessor(postProcessor);
|
||||
return wsConnection;
|
||||
}
|
||||
|
||||
@@ -79,6 +79,8 @@ public class JmsSenderConnection extends AbstractSenderConnection {
|
||||
|
||||
private MessagePostProcessor postProcessor;
|
||||
|
||||
private boolean sessionTransacted = false;
|
||||
|
||||
/** Constructs a new JMS connection with the given parameters. */
|
||||
protected JmsSenderConnection(ConnectionFactory connectionFactory,
|
||||
Connection connection,
|
||||
@@ -142,6 +144,10 @@ public class JmsSenderConnection extends AbstractSenderConnection {
|
||||
this.postProcessor = postProcessor;
|
||||
}
|
||||
|
||||
void setSessionTransacted(boolean sessionTransacted) {
|
||||
this.sessionTransacted = sessionTransacted;
|
||||
}
|
||||
|
||||
/*
|
||||
* URI
|
||||
*/
|
||||
@@ -209,6 +215,9 @@ public class JmsSenderConnection extends AbstractSenderConnection {
|
||||
}
|
||||
connection.start();
|
||||
messageProducer.send(requestMessage);
|
||||
if (session.getTransacted() && isSessionLocallyTransacted(session)) {
|
||||
JmsUtils.commitIfNecessary(session);
|
||||
}
|
||||
}
|
||||
catch (JMSException ex) {
|
||||
throw new JmsTransportException(ex);
|
||||
@@ -218,9 +227,14 @@ public class JmsSenderConnection extends AbstractSenderConnection {
|
||||
}
|
||||
}
|
||||
|
||||
/** @see org.springframework.jms.core.JmsTemplate#isSessionLocallyTransacted(Session) */
|
||||
private boolean isSessionLocallyTransacted(Session session) {
|
||||
return sessionTransacted && !ConnectionFactoryUtils.isSessionTransactional(session, connectionFactory);
|
||||
}
|
||||
|
||||
/*
|
||||
* Receiving
|
||||
*/
|
||||
* Receiving
|
||||
*/
|
||||
|
||||
protected void onReceiveBeforeRead() throws IOException {
|
||||
MessageConsumer messageConsumer = null;
|
||||
|
||||
Reference in New Issue
Block a user