Peter,

I suspect that the "large-message" mechanism interferes somehow.
https://activemq.apache.org/components/artemis/documentation/latest/large-messages.html

That mechanism has a default size limit in the same range.
Just as you, I found that there was an exact payload size from where the 
behaviour changed.
(though in my case nothing went wrong, but suddenly performance dropped due to 
higher disk i/o)
Look in the data/large-messages directory to see whether files appear there.
They might be gone quickly, so watch the directory modification-time also.

e.

-----Oorspronkelijk bericht-----
Van: Molnár Péter 3 <peter.mol...@4ig.hu> 
Verzonden: dinsdag 31 augustus 2021 21:29
Aan: users@activemq.apache.org
Onderwerp: ARTEMIS MQ - Core bridge - consumer filter - message size issue


EXTERNAL SENDER:   Do not click any links or open any attachments unless you 
trust the sender and know the content is safe.
EXPÉDITEUR EXTERNE:    Ne cliquez sur aucun lien et n’ouvrez aucune pièce 
jointe à moins qu’ils ne proviennent d’un expéditeur fiable, ou que vous ayez 
l'assurance que le contenu provient d'une source sûre.

Hi!

I'm struggling with a very strange behavior of Artemis MQ 2.18.0 (and 2.16.0 as 
well).
I have two brokers connected with core bridge. I use them with AMQP client. I 
send a message over the bridge, and it appears in the management console, looks 
like everything fine.

But if I try to read that message and

  *   the message is not sent from the AMQP client (if I send it from 
management console it's OK)
  *   and the consumer has a filter (in my case JMSCorrelationID)
  *   and the message exceeds a given size (somewhere 204895 bytes [persistent 
size], but probably the full message length is more important, I cannot find 
how to measure that... but if I decrease the correlationID length I can add the 
characters to the body and it works, however the size became larger than 204895)
  *   (and the message is bridged)
the consumer does not get the message. If any of the above conditions is not 
met, the consumer is working.

Here are the two broker configs (basically the core bridge example from 
apache-artemis-2.18.0-bin):
Broker 1:
      <connectors>
         <!-- Connector to the other node -->
         <connector name="remote-connector">tcp://localhost:61617</connector>
      </connectors>

      <!-- Acceptors -->
      <acceptors>
         <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
      </acceptors>
      <bridges>
         <bridge name="my-bridge">
            <queue-name>sausage-factory</queue-name>
            <forwarding-address>mincing-machine</forwarding-address>
            <reconnect-attempts>-1</reconnect-attempts>
            <static-connectors>
               <connector-ref>remote-connector</connector-ref>
            </static-connectors>
         </bridge>
      </bridges>
      <security-settings>
         <!--security for example queue-->
         <security-setting match="#">
            <permission roles="guest" type="createDurableQueue"/>
            <permission roles="guest" type="deleteDurableQueue"/>
            <permission roles="guest" type="createNonDurableQueue"/>
            <permission roles="guest" type="deleteNonDurableQueue"/>
            <permission roles="guest, amq" type="consume"/>
            <permission roles="guest, amq" type="send"/>
         </security-setting>
      </security-settings>
      <addresses>
         <address name="sausage-factory">
            <anycast>
               <queue name="sausage-factory"/>
            </anycast>
         </address>
      </addresses>

Broker 2:
      <!-- Acceptors -->
      <acceptors>
         <acceptor name="netty-acceptor">tcp://localhost:61617</acceptor>
      </acceptors>
      <security-settings>
         <!--security for example queue-->
         <security-setting match="#">
            <permission roles="guest" type="createDurableQueue"/>
            <permission roles="guest" type="deleteDurableQueue"/>
            <permission roles="guest" type="createNonDurableQueue"/>
            <permission roles="guest" type="deleteNonDurableQueue"/>
            <permission roles="guest, amq" type="consume"/>
            <permission roles="guest, amq" type="send"/>
         </security-setting>
      </security-settings>
      <addresses>
         <address name="mincing-machine">
            <anycast>
              <queue name="mincing-machine"/>
            </anycast>
         </address>
      </addresses>

The AMQP client written in C#, with "ArtemisNetClient" Version="2.2.2" NuGet 
package, I used for reproduction of the issue. (in the example the message not 
deleted from the queue for testing purposes, so it should be deleted manually 
in order to avoid the consumer receive it again on the next start):
using System;
using ActiveMQ.Artemis.Client;
using System.Threading.Tasks;

namespace client
{
    class AMQPClient
    {
        public async Task ReceiveMessage()
        {
            var connectionFactory = new ConnectionFactory();

            var endpoint = Endpoint.Create("localhost", 61617, "admin", 
"admin");

            var connection = await connectionFactory.CreateAsync(endpoint);
            Console.WriteLine("Connected");

            var consumer = await connection.CreateConsumerAsync(
                new ConsumerConfiguration
                {
                    Address = "mincing-machine",
                    RoutingType = RoutingType.Anycast,
                    FilterExpression = "JMSCorrelationID = '123456'"
                });
            Console.WriteLine("Consumer created");

            var message = await consumer.ReceiveAsync();
            Console.WriteLine("Message received");
            var message_body = message.GetBody<string>();
            Console.WriteLine(message_body);
        }

        public async Task SendMessage()
        {
            var connectionFactory = new ConnectionFactory();

            var endpoint = Endpoint.Create("localhost", 61616, "admin", 
"admin");

            var connection = await connectionFactory.CreateAsync(endpoint);
            Console.WriteLine("Connected");

            var producer = await 
connection.CreateProducerAsync("sausage-factory", RoutingType.Anycast);

            Message msg = new Message(CreateString(102309)); //working 102309 
not working 102310

            msg.SetCorrelationId("123456");
            await producer.SendAsync(msg);
            Console.WriteLine("Message sent");
        }

        static Random rd = new Random();
        internal static string CreateString(int stringLength)
        {
            const string allowedChars = 
"ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789!@$?_-";
            char[] chars = new char[stringLength];

            for (int i = 0; i < stringLength; i++)
            {
                chars[i] = allowedChars[rd.Next(0, allowedChars.Length)];
            }

            return new string(chars);
        }

    }

    class Program
    {
        static void Main(string[] args)
        {
            AMQPClient client = new AMQPClient();
            try
            {
                client.SendMessage().Wait();
                client.ReceiveMessage().Wait();
            }
            catch(Exception ex)
            {
                Console.WriteLine("Error!");
                Console.WriteLine(ex.ToString());
            }
        }
    }
}


In this example if the message body length is 102309 chars it is working, if it 
is 102310 it is not working!

Does anybody have a solution for this behavior?

Regards,
Peter

p.s.: I sent this mail with attachment, but doesn't appeared on the list, 
that's why I resend it in this way

<p></p>

Reply via email to