You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/05/20 15:36:30 UTC

[GitHub] [activemq-artemis] clebertsuconic opened a new pull request #3591: ARTEMIS-3310 Paging could lose AMQPmessage if match didn't work for any reason

clebertsuconic opened a new pull request #3591:
URL: https://github.com/apache/activemq-artemis/pull/3591


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3591: ARTEMIS-3310 Paging could lose AMQPmessage if match didn't work for any reason

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3591:
URL: https://github.com/apache/activemq-artemis/pull/3591#discussion_r636383902



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/ParseAppMultiThread.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.amqp;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
+import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessagePersisterV2;
+import org.apache.activemq.artemis.protocol.amqp.broker.AMQPStandardMessage;
+import org.apache.activemq.artemis.utils.RandomUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ParseAppMultiThread {
+
+
+   @Test
+   public void testMultiThreadParsing() throws Exception {
+
+      for (int rep = 0; rep < 500; rep++) {
+         String randomStr = RandomUtil.randomString();
+         HashMap map = new HashMap();
+         map.put("color", randomStr);
+         for (int i = 0; i < 10; i++) {
+            map.put("stuff" + i, "value" + i); // just filling stuff
+         }
+         AMQPStandardMessage originalMessage = AMQPStandardMessage.createMessage(1, 0, SimpleString.toSimpleString("duh"), null, null, null, null, map, null, null);
+
+
+         // doing a round trip that would be made through persistence
+         AMQPMessagePersisterV2 persister = AMQPMessagePersisterV2.getInstance();
+
+         ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
+         persister.encode(buffer, originalMessage);
+         buffer.readerIndex(1);
+
+         AMQPStandardMessage amqpStandardMessage = (AMQPStandardMessage) persister.decode(buffer, null, null);
+
+
+         if (rep == 0) {
+            // it is enough to check the first time only
+            // this is to make sure the message does not have application properties parsed
+            Field field = AMQPMessage.class.getDeclaredField("applicationProperties");

Review comment:
       @clebertsuconic there is the state of parsing as an enum exposed for testing purposes




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] clebertsuconic merged pull request #3591: ARTEMIS-3310 Paging could lose AMQPmessage if match didn't work for any reason

Posted by GitBox <gi...@apache.org>.
clebertsuconic merged pull request #3591:
URL: https://github.com/apache/activemq-artemis/pull/3591


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org