Bug 1004789

Summary: attributes on messaging queue should be read-only
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Miroslav Novak <mnovak>
Component: JMSAssignee: Jeff Mesnil <jmesnil>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav Novak <mnovak>
Severity: low Docs Contact: Russell Dickenson <rdickens>
Priority: unspecified    
Version: 6.1.1CC: brian.stansberry, csuconic, jmesnil
Target Milestone: ER3   
Target Release: EAP 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-15 16:23:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer.zip
none
client-maven-project.zip none

Description Miroslav Novak 2013-09-05 13:40:18 UTC
Description of problem:

When message selector is set on queue "testQueue" by:
/subsystem=messaging/hornetq-server=default/jms-queue=testQueue:write-attribute(name=selector,value="color='RED'")

then this is not reflected and all messages sent by producer which do not hold the condition in selector get to queue. 

Steps to Reproduce:
Download and unzip reproducer.zip:
- Run "sh prepare.sh"
- Start server by: sh start-server1.sh 127.0.0.1
- In CLI run following commands:
/subsystem=messaging/hornetq-server=default/jms-queue=testQueue:add(durable=true, entries=["java:jboss/exported/jms/queue/testQueue","jms/queue/testQueue"])
/subsystem=messaging/hornetq-server=default/jms-queue=testQueue:write-attribute(name=selector,value="color='RED'")
- Start producer by: sh start-producer.sh 127.0.0.1 jms/queue/testQueue 10 
- Start consumer by: sh start-consumer.sh 127.0.0.1 jms/queue/testQueue 


Actual results:
Consumer gets 10 messages.

Expected results:
Consumer should get 5 messages (with color='RED' property)

Comment 1 Jeff Mesnil 2013-09-13 09:10:20 UTC
there is no attached reproducer.zip

Comment 2 Miroslav Novak 2013-09-13 09:36:30 UTC
Created attachment 797223 [details]
reproducer.zip

Comment 3 Jeff Mesnil 2013-09-13 09:38:01 UTC
where are the source of the attached client.jar?

Comment 4 Miroslav Novak 2013-09-13 10:12:17 UTC
Created attachment 797258 [details]
client-maven-project.zip

It's using dependency from our engineering repo where you probably don't have access but you can still specify different dependencies for this client.

Used classes:
org.jboss.jms.client.TestProducer
org.jboss.jms.client.TestConsumer

Comment 5 Jeff Mesnil 2013-09-13 10:37:14 UTC
(In reply to Miroslav Novak from comment #0)
> - In CLI run following commands:
> /subsystem=messaging/hornetq-server=default/jms-queue=testQueue:
> add(durable=true,
> entries=["java:jboss/exported/jms/queue/testQueue","jms/queue/testQueue"])
> /subsystem=messaging/hornetq-server=default/jms-queue=testQueue:write-
> attribute(name=selector,value="color='RED'")

The test setup is not correct.
You add a JMS queue *without* a selector. When you write the selector attribute, please not that the server replied that a reload is required:

/subsystem=messaging/hornetq-server=default/jms-queue=testQueue:write-attribute(name=selector,value="color='RED'")
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

That's why your consumer receives all the message: the server has not been reloaded and the selector you added has not been taken into account.

If you change the test setup to add the queue with the selector, your consumer will receive only the filtered out message:

/subsystem=messaging/hornetq-server=default/jms-queue=testQueue:add(durable=true, entries=["java:jboss/exported/jms/queue/testQueue","jms/queue/testQueue"], selector="color='RED'")

Comment 6 Miroslav Novak 2013-09-13 11:20:09 UTC
Thanks Jeff for feedback. You're right that when queue is added with selector then everything is ok and just 'RED' messages are received by consumer.

If selector is specified after queue was created then I can see that consumer receives all messages. Reload or restart of server has no effect.

Comment 7 JBoss JIRA Server 2013-09-13 15:37:41 UTC
Jeff Mesnil <jmesnil> made a comment on jira WFLY-2071

PR for master branch

Comment 9 Miroslav Novak 2013-09-18 06:46:35 UTC
*** Bug 1004715 has been marked as a duplicate of this bug. ***

Comment 10 JBoss JIRA Server 2013-09-23 06:39:35 UTC
Jeff Mesnil <jmesnil> made a comment on jira WFLY-2071

PR merged in master branch

Comment 12 Miroslav Novak 2013-10-07 08:08:49 UTC
Verified in EAP 6.2.0.ER4. Attribute selector on queue is read-only now. Thanks Jeff for the change.