Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

Tom_Z
Hi,  

I try to run priority focussed tests with JMeter 2.11 against ActiveMQ 5.8 and some queues defined in the broker xml config.

I successfully managed to push messages into the queues by the JMeter-Samplers "JMS-Point-Point" and also "JMS-Publisher".

With both samplers I do set JMS properties whereas these are accepted by the broker and logged into the logfile when a message is received:
- JMSType (e.g. text, binary)
- JMSXGroupID
- JMSXGroupSeq
- JMSCorrelationID

But the properties "JMSPriority" and "JMSExpiration" are ignored and never set at the message. I tried both samplers, different property data types, ..., but the values are always the defaults 4 respectively 0.

Sending message : 
ActiveMQTextMessage {commandId = 6, responseRequired = true, messageId = ID:XXX, 
originalDestination = null, originalTransactionId = null, producerId = ID:XXX, destination = queue://XXX, 
transactionId = null, expiration = 0, timestamp = 1399478943839, arrival = 0, brokerInTime = 0, 
brokerOutTime = 0, correlationId = correlationDummyId-2, replyTo = null, persistent = true, type = text, 
priority = 4, groupID = groupId-icollect, groupSequence = 2, targetConsumerId = null, compressed = false,
userID = null, content = null, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, 
size = 0, properties = null, readOnlyProperties = false, readOnlyBody = false, droppable = false, 
text = <XMLTestMessage queue="XXX">}

I configured the queues to support message priority (http://activemq.apache.org/how-can-i-support-priority-queues.html) and I do understand that delivery to a client always in order of priority depends on different other settings (http://architects.dzone.com/articles/activemq-message-priorities), but the value provided by the producer should nevertheless be accepted and logged?

Since JMSExpiration doesn't work too I guess it's a matter of providing those values from JMeter via the ActiveMQ-Client-Impl to the broker? Is it possible at all to set those message properties with JMeter and to test scenarios of message priority?

Thanks,
Tom
Reply | Threaded
Open this post in threaded view
|

Re: Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

artnaseef
As per the JMS specification, several headers, including JMSPriority, are set on send() by the JMS provider (ActiveMQ).  This means that values specified by clients are overwritten.

Here's the spec; see section 3.4.11, "How Message Header Values are Set":

http://download.oracle.com/otn-pub/jcp/7195-jms-1.1-fr-spec-oth-JSpec/jms-1_1-fr-spec.pdf?AuthParam=1399518519_977545569f47e0da60da93ab6d7b22f0

To set the priority, the producer's setPriority() or "send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive)" needs to be used.  I'm not sure how that can be accomplished with JMeter.
Reply | Threaded
Open this post in threaded view
|

Re: Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

Tom_Z
I took a look at the jmeter source code, there are some other settings and properties treated in a special way, e.g.:

1. Checkbox for persistent delivery --> set at the MessageProducer in org.apache.jmeter.protocol.jms.client.Publisher

2. JMSCorrelationID taken from JMS-Properties list --> set at the message in org.apache.jmeter.protocol.jms.Utils

It seems that those other properties are not yet supported.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

artnaseef
Is there a way in jmeter to set properties on the JMS producer?  That might work.
Reply | Threaded
Open this post in threaded view
|

Re: Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

Tom_Z
Yes or to be correct at the message, e.g. CorrelationID:

org.apache.jmeter.protocol.jms.Utils.addJMSProperties(Message, Map<String, Object>):
public static void addJMSProperties(Message msg, Map<String, Object> map) throws JMSException {
        if(map == null) {
            return;
        }
        for (Map.Entry<String, Object> me : map.entrySet()) {
            String name = me.getKey();
            Object value = me.getValue();

            if("JMSCorrelationID".equalsIgnoreCase(name)) {
                msg.setJMSCorrelationID((String)value);
            } else {
                msg.setObjectProperty(name, value);
            }
        }
    }

The same should apply to properties "JMSPriority" (msg.setJMSPriority(int)) and "JMSExpiration" (msg.setJMSExpiration(long)).

I will file a feature issue and try to provide a patch in the next couple of days.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: Testing against ActiveMQ with JMeter: how to set JMSPriority and JMSExpiration, values cannot be seen in Broker

Tom_Z
Filed an issue and provided a patch: https://issues.apache.org/bugzilla/show_bug.cgi?id=56510