Javadoc
This commit is contained in:
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import javax.jms.BytesMessage;
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.MessageConsumer;
|
||||
@@ -37,7 +38,8 @@ import org.springframework.ws.transport.WebServiceMessageSender;
|
||||
import org.springframework.ws.transport.jms.support.JmsTransportUtils;
|
||||
|
||||
/**
|
||||
* {@link WebServiceMessageSender} implementation that uses JMS {@link BytesMessage}.
|
||||
* {@link WebServiceMessageSender} implementation that uses JMS {@link BytesMessage}s. Requires a JMS {@link
|
||||
* ConnectionFactory} to operate.
|
||||
* <p/>
|
||||
* This message sender supports URI's of the following format: <blockquote> <tt><b>jms:</b></tt><i>destination</i>[<tt><b>?</b></tt><i>param-name</i><tt><b>=</b></tt><i>param-value</i>][<tt><b>&</b></tt><i>param-name</i><tt><b>=</b></tt><i>param-value</i>]*
|
||||
* </blockquote> where the characters <tt><b>:</b></tt>, <tt><b>?</b></tt>, and <tt><b>&</b></tt> stand for
|
||||
@@ -58,7 +60,7 @@ import org.springframework.ws.transport.jms.support.JmsTransportUtils;
|
||||
* Some examples of JMS URIs are:
|
||||
* <p/>
|
||||
* <blockquote> <tt>jms:SomeQueue</tt><br> <tt>jms:SomeTopic?priority=3&deliveryMode=NON_PERSISTENT</tt><br>
|
||||
* <tt>jms:RequestQueue?replyToName=ResponseName</tt><br> </blockquote>
|
||||
* <tt>jms:RequestQueue?replyToName=ResponseQueueName</tt></blockquote>
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @see <a href="http://www.ietf.org/internet-drafts/draft-merrick-jms-iri-00.txt">IRI Scheme for Java(tm) Message
|
||||
@@ -72,9 +74,26 @@ public class JmsMessageSender extends JmsDestinationAccessor implements WebServi
|
||||
|
||||
private long receiveTimeout = DEFAULT_RECEIVE_TIMEOUT;
|
||||
|
||||
/**
|
||||
* Create a new <code>JmsMessageSender</code>
|
||||
* <p/>
|
||||
* <b>Note</b>: The ConnectionFactory has to be set before using the instance. This constructor can be used to
|
||||
* prepare a JmsTemplate via a BeanFactory, typically setting the ConnectionFactory via setConnectionFactory.
|
||||
*
|
||||
* @see #setConnectionFactory(ConnectionFactory)
|
||||
*/
|
||||
public JmsMessageSender() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new <code>JmsMessageSender</code>, given a ConnectionFactory.
|
||||
*
|
||||
* @param connectionFactory the ConnectionFactory to obtain Connections from
|
||||
*/
|
||||
public JmsMessageSender(ConnectionFactory connectionFactory) {
|
||||
setConnectionFactory(connectionFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the timeout to use for receive calls. The default is -1, which means no timeout.
|
||||
*
|
||||
|
||||
@@ -40,7 +40,8 @@ import org.springframework.ws.transport.WebServiceConnection;
|
||||
import org.springframework.ws.transport.support.EnumerationIterator;
|
||||
|
||||
/**
|
||||
* Implementation of {@link WebServiceConnection} that is used for client-side JMS access.
|
||||
* Implementation of {@link WebServiceConnection} that is used for client-side JMS access. Exposes a {@link
|
||||
* BytesMessage} request and response message.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.1.0
|
||||
|
||||
@@ -32,11 +32,13 @@ public class JmsTransportException extends TransportException {
|
||||
|
||||
public JmsTransportException(String msg, JMSException ex) {
|
||||
super(msg + ": " + ex.getMessage());
|
||||
initCause(ex);
|
||||
jmsException = ex;
|
||||
}
|
||||
|
||||
public JmsTransportException(JMSException ex) {
|
||||
super(ex.getMessage());
|
||||
initCause(ex);
|
||||
jmsException = ex;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,16 @@ import junit.framework.TestCase;
|
||||
|
||||
public class JmsTransportUtilsTest extends TestCase {
|
||||
|
||||
public void testGetDestinationName() throws Exception {
|
||||
URI uri = new URI("jms:RequestQueue?replyToName=RESP_QUEUE");
|
||||
String destinationName = JmsTransportUtils.getDestinationName(uri);
|
||||
assertEquals("Invalid destination", "RequestQueue", destinationName);
|
||||
|
||||
uri = new URI("jms:RequestQueue");
|
||||
destinationName = JmsTransportUtils.getDestinationName(uri);
|
||||
assertEquals("Invalid destination", "RequestQueue", destinationName);
|
||||
}
|
||||
|
||||
public void testGetDeliveryMode() throws Exception {
|
||||
URI uri = new URI("jms:RequestQueue?deliveryMode=NON_PERSISTENT");
|
||||
int deliveryMode = JmsTransportUtils.getDeliveryMode(uri);
|
||||
@@ -67,14 +77,4 @@ public class JmsTransportUtilsTest extends TestCase {
|
||||
replyToName = JmsTransportUtils.getReplyToName(uri);
|
||||
assertNull("Invalid replyToName", replyToName);
|
||||
}
|
||||
|
||||
public void testGetDestinationName() throws Exception {
|
||||
URI uri = new URI("jms:RequestQueue?replyToName=RESP_QUEUE");
|
||||
String destinationName = JmsTransportUtils.getDestinationName(uri);
|
||||
assertEquals("Invalid destination", "RequestQueue", destinationName);
|
||||
|
||||
uri = new URI("jms:RequestQueue");
|
||||
destinationName = JmsTransportUtils.getDestinationName(uri);
|
||||
assertEquals("Invalid destination", "RequestQueue", destinationName);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.ws.transport.jms;
|
||||
package org.springframework.ws.transport.support;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
|
||||
|
||||
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
|
||||
@@ -33,7 +33,7 @@
|
||||
<property name="endpointMappings">
|
||||
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
|
||||
<property name="defaultEndpoint">
|
||||
<bean class="org.springframework.ws.transport.jms.EchoPayloadEndpoint"/>
|
||||
<bean class="org.springframework.ws.transport.support.EchoPayloadEndpoint"/>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user