[ 
https://issues.apache.org/jira/browse/QPID-6954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15350927#comment-15350927
 ] 

Rob Godfrey commented on QPID-6954:
-----------------------------------

[~k-wall] On your first point, the function is a converter, not a copier - so I 
actually think the current behaviour is more "correct", however the primary use 
case here is the REST API calling in with a value, or a static default being 
converted - in both cases the map is not going to be changed.  As such I think 
it would be odd to do a deep copy here when we don't otherwise.
On your second point, I agree an NPE is undesirable.  Ideally we should allow 
for metadata driven defaulting, however using the Defaults class as you suggest 
would seem to give the same behaviour - however I think it should probably only 
be used in the case where the key is not present in the map.  If the key is 
present then we should always use the value for the conversion - even if this 
ends up with an NPE.

> [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]

Reply via email to