mirror of https://github.com/apache/activemq.git
assign default JMS priority when none is set on a Message. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1071432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0c678e9a0
commit
14722f8627
|
@ -22,9 +22,12 @@ import java.util.Map;
|
|||
|
||||
import javax.jms.Destination;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.MessageListener;
|
||||
import javax.jms.MessageProducer;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.command.ActiveMQMessage;
|
||||
import org.apache.activemq.command.Message;
|
||||
|
||||
/**
|
||||
* Implementations of this interface are used to map back and forth from Stomp
|
||||
|
@ -81,7 +84,7 @@ public interface FrameTranslator {
|
|||
if (message.getOriginalDestination() != null) {
|
||||
headers.put(Stomp.Headers.Message.ORIGINAL_DESTINATION, ft.convertDestination(converter, message.getOriginalDestination()));
|
||||
}
|
||||
|
||||
|
||||
// now lets add all the message headers
|
||||
final Map<String, Object> properties = message.getProperties();
|
||||
if (properties != null) {
|
||||
|
@ -107,6 +110,8 @@ public interface FrameTranslator {
|
|||
o = headers.remove(Stomp.Headers.Send.PRIORITY);
|
||||
if (o != null) {
|
||||
msg.setJMSPriority(Integer.parseInt((String)o));
|
||||
} else {
|
||||
msg.setJMSPriority(javax.jms.Message.DEFAULT_PRIORITY);
|
||||
}
|
||||
|
||||
o = headers.remove(Stomp.Headers.Send.TYPE);
|
||||
|
|
|
@ -296,6 +296,27 @@ public class StompTest extends CombinationTestSupport {
|
|||
assertEquals("GroupID", "abc", amqMessage.getGroupID());
|
||||
}
|
||||
|
||||
public void testSendMessageWithNoPriorityReceivesDefault() throws Exception {
|
||||
|
||||
MessageConsumer consumer = session.createConsumer(queue);
|
||||
|
||||
String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL;
|
||||
stompConnection.sendFrame(frame);
|
||||
|
||||
frame = stompConnection.receiveFrame();
|
||||
assertTrue(frame.startsWith("CONNECTED"));
|
||||
|
||||
frame = "SEND\n" + "correlation-id:c123\n" + "destination:/queue/" + getQueueName() + "\n\n" + "Hello World"
|
||||
+ Stomp.NULL;
|
||||
|
||||
stompConnection.sendFrame(frame);
|
||||
|
||||
TextMessage message = (TextMessage)consumer.receive(2500);
|
||||
assertNotNull(message);
|
||||
assertEquals("Hello World", message.getText());
|
||||
assertEquals("getJMSPriority", 4, message.getJMSPriority());
|
||||
}
|
||||
|
||||
public void testReceipts() throws Exception {
|
||||
|
||||
StompConnection receiver = new StompConnection();
|
||||
|
|
Loading…
Reference in New Issue