Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Summary: Support sending of ByteMessage for JMS Publisher.
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.8
Hardware: All All
: P2 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-21 15:13 UTC by mchassagneux
Modified: 2013-01-08 07:54 UTC (History)
1 user (show)



Attachments
Message to send (857 bytes, text/plain)
2013-01-07 14:52 UTC, mchassagneux
Details
Test Plan (6.01 KB, application/octet-stream)
2013-01-07 14:54 UTC, mchassagneux
Details
Test plan showing it works (9.40 KB, application/xml)
2013-01-07 22:28 UTC, Philippe Mouawad
Details
Test plan showing it works (9.40 KB, application/xml)
2013-01-07 22:34 UTC, Philippe Mouawad
Details
Test plan showing it works (9.40 KB, application/xml)
2013-01-07 22:34 UTC, Philippe Mouawad
Details

Note You need to log in before you can comment on or make changes to this bug.
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) {
            producer.send(bmsg);
        } 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
Log:
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Bugzilla Id: 54182

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/JLabeledRadioI18N.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
    jmeter/trunk/xdocs/changes.xml
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
Log:
Bug 54182 - Support sending of ByteMessage for JMS Publisher.
Default to text message
Bugzilla Id: 54182

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPublisherGui.java


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

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

Modified:
    jmeter/trunk/docs/images/screenshots/jmspublisher.png
    jmeter/trunk/xdocs/images/screenshots/jmspublisher.png
    jmeter/trunk/xdocs/usermanual/component_reference.xml

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

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

Modified:
    jmeter/trunk/xdocs/usermanual/component_reference.xml
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
Hello,
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 :

<message>
	<VersionMsgMonitoring>V1.0</VersionMsgMonitoring>
	<TypeMsgMonitoring>1</TypeMsgMonitoring>
	<QueueManager>QTPATL</QueueManager>
	<Curdepth>0</Curdepth>
</message>
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
Hello,
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 !
Comment 15 The ASF infrastructure team 2022-09-24 20:37:52 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2991