[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16030749#comment-16030749
 ] 

ASF GitHub Bot commented on ARTEMIS-1176:
-

Github user gnodet closed the pull request at:

https://github.com/apache/activemq-artemis/pull/1305


> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16030748#comment-16030748
 ] 

ASF GitHub Bot commented on ARTEMIS-1176:
-

Github user gnodet commented on the issue:

https://github.com/apache/activemq-artemis/pull/1305
  
The problem has already been fixed it seems.


> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16030646#comment-16030646
 ] 

ASF GitHub Bot commented on ARTEMIS-1176:
-

GitHub user gnodet opened a pull request:

https://github.com/apache/activemq-artemis/pull/1305

ARTEMIS-1176 - Turn management reply messages into text messages



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gnodet/activemq-artemis mgmt-reply-message

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/activemq-artemis/pull/1305.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1305


commit c2fca338c2b3a7fbf19ec7927a831d9a0f5418fb
Author: Guillaume Nodet 
Date:   2017-05-19T08:00:32Z

[ARTEMIS-1176] Turn management reply messages into text messages

commit 2d646df0449273c7a6b3e644bbe572c5bd4756cc
Author: Guillaume Nodet 
Date:   2017-05-31T05:14:07Z

[ARTEMIS-1176] Fix extraction of management results from text messages




> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-30 Thread Guillaume Nodet (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16028813#comment-16028813
 ] 

Guillaume Nodet commented on ARTEMIS-1176:
--

So the problem seems to be that the ActiveMQTextMessage which is built for the 
response eagerly reads the body as a string, so that the ManagementHelper which 
uses the ICoreMessage body can't work anymore as the body has been read already.

I see a few options:
  * keep the response as a text message and fix the management layer to support 
it (see patch below)
  * investigate changing the JMS messages to lazily read the body (but this 
could change some behavior)
  * don't fix the issue (the original issue is that the management layer can't 
be used with pure JMS api)

Patch for management layer:
{code}
diff --git 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java
 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java
index 946285da8..20c0cd076 100644
--- 
a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java
+++ 
b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java
@@ -197,7 +197,16 @@ public final class ManagementHelper {
public static Object[] getResults(final ICoreMessage message) throws 
Exception {
   SimpleString sstring = 
message.getBodyBuffer().readNullableSimpleString();
   String jsonString = (sstring == null) ? null : sstring.toString();
+  return getResults(jsonString);
+   }
 
+   /**
+* Returns the result of an operation invocation or an attribute value.
+* 
+* If an error occurred on the server, {@link 
#hasOperationSucceeded(Message)} will return {@code false}.
+* and the result will be a String corresponding to the server exception.
+*/
+   public static Object[] getResults(final String jsonString) throws Exception 
{
   if (jsonString != null) {
  JsonArray jsonArray = JsonUtil.readJsonArray(jsonString);
  return JsonUtil.fromJsonArray(jsonArray);
@@ -233,6 +242,22 @@ public final class ManagementHelper {
}
 
/**
+* Returns the result of an operation invocation or an attribute value.
+* 
+* If an error occurred on the server, {@link 
#hasOperationSucceeded(Message)} will return {@code false}.
+* and the result will be a String corresponding to the server exception.
+*/
+   public static Object getResult(final String message, Class desiredType) 
throws Exception {
+  Object[] res = ManagementHelper.getResults(message);
+
+  if (res != null) {
+ return JsonUtil.convertJsonValue(res[0], desiredType);
+  } else {
+ return null;
+  }
+   }
+
+   /**
 * Returns whether the invocation of the management operation on the server 
resource succeeded.
 */
public static boolean hasOperationSucceeded(final Message message) {
diff --git 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/JMSManagementHelper.java
 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/JMSManagementHelper.java
index 4d0306ba5..b7ba4a695 100644
--- 
a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/JMSManagementHelper.java
+++ 
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/api/jms/management/JMSManagementHelper.java
@@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.jms.management;
 
 import javax.jms.JMSException;
 import javax.jms.Message;
+import javax.jms.TextMessage;
 
 import org.apache.activemq.artemis.api.core.client.ClientMessage;
 import org.apache.activemq.artemis.api.core.management.ManagementHelper;
@@ -147,7 +148,11 @@ public class JMSManagementHelper {
 * and the result will be a String corresponding to the server exception.
 */
public static Object getResult(final Message message, Class desiredType) 
throws Exception {
-  return 
ManagementHelper.getResult(JMSManagementHelper.getCoreMessage(message), 
desiredType);
+  if (message instanceof TextMessage) {
+ return ManagementHelper.getResult(((TextMessage) message).getText(), 
desiredType);
+  } else {
+ return 
ManagementHelper.getResult(JMSManagementHelper.getCoreMessage(message), 
desiredType);
+  }
}
 
private JMSManagementHelper() {
{code}

> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-24 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16023828#comment-16023828
 ] 

ASF subversion and git services commented on ARTEMIS-1176:
--

Commit 15bb4d2c6169488c572f51f63b12005bda00478c in activemq-artemis's branch 
refs/heads/master from Clebert Suconic
[ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=15bb4d2 ]

ARTEMIS-1176 Fixing reading from JMS Messages as core messages


> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-23 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16021196#comment-16021196
 ] 

ASF subversion and git services commented on ARTEMIS-1176:
--

Commit 7e47dc3e07328b46804d4c58f320bc14bf8e84c0 in activemq-artemis's branch 
refs/heads/master from [~gnt]
[ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=7e47dc3 ]

[ARTEMIS-1176] Turn management reply messages into text messages

> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16020164#comment-16020164
 ] 

ASF GitHub Bot commented on ARTEMIS-1176:
-

Github user gnodet commented on the issue:

https://github.com/apache/activemq-artemis/pull/1284
  
JIRA: https://issues.apache.org/jira/browse/ARTEMIS-1176



> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (ARTEMIS-1176) Use text messages for management reply messages

2017-05-19 Thread Guillaume Nodet (JIRA)

[ 
https://issues.apache.org/jira/browse/ARTEMIS-1176?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16018317#comment-16018317
 ] 

Guillaume Nodet commented on ARTEMIS-1176:
--

PR https://github.com/apache/activemq-artemis/pull/1284

> Use text messages for management reply messages
> ---
>
> Key: ARTEMIS-1176
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1176
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Guillaume Nodet
>Assignee: Guillaume Nodet
> Fix For: 2.2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)