Bug 54182

Summary: Support sending of ByteMessage for JMS Publisher.
Product: JMeter Reporter: mchassagneux
Component: MainAssignee: JMeter issues mailing list <issues>
Severity: enhancement CC: p.mouawad
Priority: P2    
Version: 2.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Message to send
Test Plan
Test plan showing it works
Test plan showing it works
Test plan showing it works

Description mchassagneux 2012-11-21 15:13:20 UTC
Please could you add in the publisher JMS sample, the possibility to send a message text as ByteMessage. 

Like something like this :

public BytesMessage publish(String text, String destinationName, Map<String, String> properties)
            throws JMSException, NamingException {

        byte[] bArray = text.getBytes("UTF-8");
        BytesMessage bmsg = session.createTextMessage( bArray );
        Utils.addJMSProperties(bmsg, properties);
        if (staticDest || destinationName == null) {
        } else {
            Destination dest = Utils.lookupDestination(ctx, destinationName);
            producer.send(dest, bmsg);
        return bmsg;

Thx in advance.
Comment 1 Philippe Mouawad 2013-01-04 21:07:45 UTC
Date: Fri Jan  4 21:06:46 2013
New Revision: 1429128

URL: http://svn.apache.org/viewvc?rev=1429128&view=rev
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Bugzilla Id: 54182

Comment 2 Philippe Mouawad 2013-01-04 21:22:18 UTC
Date: Fri Jan  4 21:14:14 2013
New Revision: 1429130

URL: http://svn.apache.org/viewvc?rev=1429130&view=rev
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Default to text message
Bugzilla Id: 54182


Date: Fri Jan  4 21:14:57 2013
New Revision: 1429131

URL: http://svn.apache.org/viewvc?rev=1429131&view=rev
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Bugzilla Id: 54182


Date: Fri Jan  4 21:21:19 2013
New Revision: 1429133

URL: http://svn.apache.org/viewvc?rev=1429133&view=rev
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Update docs
Bugzilla Id: 54182

Comment 3 mchassagneux 2013-01-07 14:40:28 UTC
I've try this patch but it doesn't work, I obtain this message :

java.lang.IllegalArgumentException: n must be positive

JMeter expect to find directly in the file a byte message ?
Comment 4 Philippe Mouawad 2013-01-07 14:42:29 UTC
Did you try the nightly build or applied the patch yourself ?

Yes file is supposed to contain the bytes that will be put in BytesMessage.
Can you show the full Stacktrace or attach jmeter.log ?
Comment 5 mchassagneux 2013-01-07 14:48:46 UTC
I've try the nightly build. 

I think the problem came from my message source. 
Indeed I thought that JMeter could transform my message text directly in byte message... 
Like SoapUI do, with the option "Send as ByteMessage"

My message is a simple xml file like :

Comment 6 Philippe Mouawad 2013-01-07 14:50:47 UTC
Can you attach your Test Plan and test message, I am not sure to understand
Comment 7 mchassagneux 2013-01-07 14:52:54 UTC
Created attachment 29823 [details]
Message to send
Comment 8 mchassagneux 2013-01-07 14:54:32 UTC
Created attachment 29824 [details]
Test Plan
Comment 9 Philippe Mouawad 2013-01-07 22:28:09 UTC
In the Test Plan you submitted you are not using Bytes Messages.
You checked :
- Random File from folder specified below
- Text Message

I tested, it works for me.

I renamed the message file with extension .dat, and checked Bytes Messages and it also works.
Comment 10 Philippe Mouawad 2013-01-07 22:28:58 UTC
Created attachment 29825 [details]
Test plan showing it works
Comment 11 Philippe Mouawad 2013-01-07 22:29:42 UTC
If issue is still here for you, please attach jmeter.log
Comment 12 Philippe Mouawad 2013-01-07 22:34:03 UTC
Created attachment 29826 [details]
Test plan showing it works
Comment 13 Philippe Mouawad 2013-01-07 22:34:22 UTC
Created attachment 29827 [details]
Test plan showing it works
Comment 14 mchassagneux 2013-01-08 07:54:44 UTC
Indeed the issue came from an old librairie which was lying in my lib directory. (i.e commons-io-1.4.jar )and  that doesn't provide the "toByteArray(InputStream input, long size)"  method 

Sorry again, and very thanks for adding this function which will be very usefull for me !