You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rob Godfrey (JIRA)" <ji...@apache.org> on 2015/12/15 21:45:46 UTC

[jira] [Updated] (QPID-6954) [Java Broker] Add the ability to define "policies" for node auto-creation based on address

     [ https://issues.apache.org/jira/browse/QPID-6954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Godfrey updated QPID-6954:
------------------------------
    Description: 
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}

 

  was:
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",
  "context" : {
    "foo" : "1"
  },
  "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}

 


> [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: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org