Reputation: 601
Don't think this has been asked this specifically.
I have to run a performance test on a application that consumes from a ActiveMQ topic. The sampler needs to publish 4 Bytes of data in to the topic which usually be the format of (if you look at the hex value) 0x006403D6.
If you translate them in to decimals, they will be
0x03D6 = 00000011 11010110 ==> 982 ==> 03,D6 ==> 03, 214 ==> 3,214 0x0064 = 00000000 01100100 ==> 100 ==> 00,64 ==> 00, 100 ==> 0,100
So the above example the 4 bytes will be [0,100,3,214].
To get this done I have used a JMSPublisher.
The below is the configuration:
Since I have to send a byte stream I thought to use a ByteMessage from a file.
I tried above with different content in the file in the configuration. But non would give me [0,100,3,214].
It looks like JMeter does convert the text, characters in to byte values. So If I have a empty file the topic will reeve 0 and application will consider it as [0,0,0,0] (Application considers only the first 4 bytes)
If I have ???? in the text file I get [63,63,63,63] (As ? ==> 00111111 ==> 63 in Decimal). But If I have to get the first byte a 0, I am unable to get that through? As there is no character I could found to represent 0.
May be There is a better way of doing this. Please advise ?
Upvotes: 0
Views: 818
Reputation: 168132
Looking into JMS Sampler JavaDoc, the setContent()
function accepts String only so there is no way to pass bytes to this as JMeter will treat them as a simple string.
However as per JMS Publisher documentation you should be able to send whatever you want given the object is serialised by XStream
The Object message is implemented and works as follow:
Put the JAR that contains your object and its dependencies in jmeter_home/lib/ folder
Serialize your object as XML using XStream
Either put result in a file suffixed with .txt or .obj or put XML content directly in Text Area
Note that if message is in a file, replacement of properties will not occur while it will if you use Text Area.
Also be aware that you can always switch to JSR223 Sampler and use ByteMessage class from Groovy code.
Upvotes: 1