Github user pmouawad commented on a diff in the pull request:
https://github.com/apache/jmeter/pull/325#discussion_r150327668
--- Diff:
src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java ---
@@ -142,48 +173,244 @@ public SampleResult sample(Entry entry) {
res.sampleStart();
try {
- TextMessage msg = createMessage();
- if (isOneway()) {
- int deliveryMode = isNonPersistent() ?
-
DeliveryMode.NON_PERSISTENT:DeliveryMode.PERSISTENT;
- producer.send(msg, deliveryMode,
Integer.parseInt(getPriority()),
- Long.parseLong(getExpiration()));
- res.setRequestHeaders(Utils.messageProperties(msg));
- res.setResponseOK();
- res.setResponseData("Oneway request has no response data",
null);
+ LOGGER.debug("Point-to-point mode: " +
getCommunicationstyle());
+ if (isBrowse()) {
+ handleBrowse(res);
+ } else if (isClearQueue()) {
+ handleClearQueue(res);
+ } else if (isOneway()) {
+ handleOneWay(res);
+ } else if (isRead()) {
+ handleRead(context, res);
} else {
- if (!useTemporyQueue()) {
- msg.setJMSReplyTo(receiveQueue);
- }
- Message replyMsg = executor.sendAndReceive(msg,
- isNonPersistent() ? DeliveryMode.NON_PERSISTENT :
DeliveryMode.PERSISTENT,
- Integer.parseInt(getPriority()),
- Long.parseLong(getExpiration()));
- res.setRequestHeaders(Utils.messageProperties(msg));
- if (replyMsg == null) {
- res.setResponseMessage("No reply message received");
- } else {
- if (replyMsg instanceof TextMessage) {
- res.setResponseData(((TextMessage)
replyMsg).getText(), null);
- } else {
- res.setResponseData(replyMsg.toString(), null);
- }
-
res.setResponseHeaders(Utils.messageProperties(replyMsg));
- res.setResponseOK();
- }
+ handleRequestResponse(res);
}
} catch (Exception e) {
LOGGER.warn(e.getLocalizedMessage(), e);
- if (thrown != null){
+ if (thrown != null) {
res.setResponseMessage(thrown.toString());
- } else {
+ } else {
res.setResponseMessage(e.getLocalizedMessage());
}
}
res.sampleEnd();
return res;
}
+ private void handleBrowse(SampleResult res) throws JMSException {
+ LOGGER.debug("isBrowseOnly");
+ StringBuffer sb = new StringBuffer("");
--- End diff --
StringBuilder would be better here, and wherever StringBuffer is used
---