[
https://issues.jboss.org/browse/WFLY-6349?page=com.atlassian.jira.plugin....
]
Harald Wellmann commented on WFLY-6349:
---------------------------------------
Thanks for this example - it turns out we're not quite looking at the same problem.
Your example also sets {{JMSXGroupSeq}} in addition to {{JMSXGroupId}}. I didn't set
the former, in fact I wasn't aware of it, since it is not mentioned in
https://activemq.apache.org/artemis/docs/1.1.0/message-grouping.html, nor in the latest
HornetQ manual.
In your example, if you replace
{code}
producer.setProperty("JMSXGroupSeq", i).send(destination, text);
{code}
by
{code}
producer.send(destination, text);
{code}
you will also see the messages being received in random order. (Tried on a local build of
10.1.0-SNAPSHOT.)
But if you set the properties on the messages, not on the producer, the sequential order
will be restored:
{code}
String text = "This is message " + (i + 1);
TextMessage textMessage = context.createTextMessage(text);
textMessage.setStringProperty("JMSXGroupID", "sequential");
textMessage.setStringProperty("foo", "bar");
producer.send(destination, textMessage); // textMessage, not text!
{code}
So maybe if this behaviour is coincidental, and if the basic rule is that JMSXGroupID
should never be used without JMSGroupSeq, then at least the docs should be updated.
JMSXGroupId has no effect on JMSProducer
----------------------------------------
Key: WFLY-6349
URL:
https://issues.jboss.org/browse/WFLY-6349
Project: WildFly
Issue Type: Bug
Components: JMS
Affects Versions: 10.0.0.Final
Reporter: Harald Wellmann
Assignee: Jeff Mesnil
Fix For: 10.1.0.Final
h3. Scenario
I'm setting the {{JMSXGroupID}} on a {{JMSProducer}} to achieve message delivery in
the correct order. The consumer is a message-driven bean.
{code}
JMSProducer producer = context.createProducer();
producer = producer.setProperty("JMSXGroupID",
"sequential");
producer = producer.setProperty("foo", "bar");
for (int i = 0; i < 50; i++) {
msgNumber++;
String text = "This is message " + msgNumber;
producer.send(queue, text);
}
{code}
h3. Expected Behaviour
The messages are received in the correct order, the properties {{JMSXGroupID}} and
{{foo}} are set on the receiver side.
h3. Actual Behaviour
The messages are received in random order. Property {{foo}} is set, but property
{{JMSXGroupID}} is null on the receiver side.
h3. Workaround
Create a {{TextMessage}} and set the properties on the message, not on the producer.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)