[
https://issues.apache.org/jira/browse/QPID-6954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350908#comment-15350908
]
Keith Wall edited comment on QPID-6954 at 6/27/16 12:30 PM:
------------------------------------------------------------
Rob, the changes look good:
Two comments:
* In
{{org.apache.qpid.server.model.AttributeValueConverter.ManageableAttributeTypeConverter#convert}}
the proxy is backed by the Map provided by the caller. If the Map were to
change later, the MAV would change too and I think this behaviour would be
surprising. A deep clone would be most desirable, but this is tricky as the
Map could contain values of any type, which might not be cloneable. I think a
defensive copy of the Map would still be a good idea.
* If the {{ManageableAttributeValue}} has a method that returns a primitive, a
NPE will occur on line
org.apache.qpid.server.model.AttributeValueConverter#convert:1183 if the map
has no value for the attribute or that value is null. We should guard the
primitive case and return the primitive's default value
{{com.google.common.base.Defaults}}.
was (Author: k-wall):
Rob, the changes look good:
Two comments:
* In
{{org.apache.qpid.server.model.AttributeValueConverter.ManageableAttributeTypeConverter#convert}}
the proxy is backed by the Map provided by the caller. If the Map were to
change later, the MAV would change too and I think this behaviour would be
surprising. A deep clone would be most desirable, but this is tricky as the
Map could contain values of any type, which might not be cloneable. I think a
defensive copy of the Map would still be a good idea.
* If the {{ManageableAttributeValue}} has a method that returns a primitive, a
NPE will occur on line
org.apache.qpid.server.model.AttributeValueConverter#convert:1183 if the map
has no value for the attribute or that value is null. We should guard the
primitive case and return the primitive default value
{{com.google.common.base.Defaults}}.
> [Java Broker] Add the ability to define "policies" for node auto-creation
> based on address
> ------------------------------------------------------------------------------------------
>
> Key: QPID-6954
> URL: https://issues.apache.org/jira/browse/QPID-6954
> Project: Qpid
> Issue Type: Improvement
> Components: Java Broker
> Reporter: Rob Godfrey
> Assignee: Rob Godfrey
> Fix For: qpid-java-6.1
>
>
> See: [this
> mail|http://mail-archives.apache.org/mod_mbox/qpid-users/201512.mbox/%3C55CF1C5A18D1B84CAE275B17381A7C6CC174E2825B%40winavi5.AviFN.local%3E]
> and QPID-5251 (C++ Broker equivalent).
> It is sometimes useful to be able to provide behaviours based on
> namespaces/patterns such that queues/exchanges which match those patterns get
> automatically created.
> Add a new property to the virtualHost called "nodeAutoCreationPolicies",
> which is a list of polices. A policy is an object with attributes "pattern",
> "nodeType", "createdOnPublish", "createdOnConsume" and "attributes".
> * pattern is a Java RegExp which will be matched against the name used by the
> client for an incoming published message / consume request.
> * nodeType is one of "queue" or "exchange".
> * createdOnPublish is a boolean indicating whether the node should be created
> when new messages are published (or an incoming link is created)
> * createdOnConsume is a boolean indicating whether the node should be created
> when a new consumer is created
> * attributes is a map, containing the default attributes of the node to be
> created. These attributes are the same used in the REST API for the node
> type.
> The nodeAutoCreationPolicies can be set via the REST API, or (if you are
> using a JSON VirtualHostNode) by hand editing the virtualHost configuration.
> For instance here is a snippet from a JSON virtualHost configuration with
> defined nodeAutoCreationPolicies:
> {code:javascript}
> {
> "id" : "134c0b84-b1b2-46c8-ba2d-f05ba13be56f",
> "name" : "default",
> "type" : "BDB",
> "modelVersion" : "6.1",
> "nodeAutoCreationPolicies" : [ {
> "pattern" : "rob\\.durable\\..*",
> "createdOnPublish" : true,
> "createdOnConsume" : true,
> "nodeType" : "queue",
> "attributes" : {
> "durable" : true
> }
> }, {
> "pattern" : "rob\\.exchange\\..*",
> "createdOnPublish" : true,
> "createdOnConsume" : false,
> "nodeType" : "exchange",
> "attributes" : {
> "type" : "direct",
> "durable" : true
> }
> } ],
> "queue.deadLetterQueueEnabled" : false,
> "exchanges" : [ {
> "id" : "5fcbd3f5-fe7c-4ab0-9605-950d7784844c",
> "name" : "amq.direct",
> "type" : "direct"
> }, {
> "id" : "3f17dd6f-269b-43a6-868e-dd487271719a",
> "name" : "amq.fanout",
> "type" : "fanout"
> }, {
> "id" : "45e9eba0-3bcc-4634-b042-87a652447cbe",
> "name" : "amq.match",
> "type" : "headers"
> }, {
> "id" : "d7b703c4-0d64-4a44-8008-1314a18e30e7",
> "name" : "amq.topic",
> "type" : "topic"
> } ],
> {code}
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]