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

Rob Godfrey edited comment on QPID-6161 at 10/7/15 9:27 AM:
------------------------------------------------------------

Hi [~danlangford],

as you noticed, we haven't currently added a UI for this in the web management 
console, though the mechanisms for adding/removing/modifying the aliases are 
available through the HTTP management API, or alternatively you can just hand 
edit the json config file.  

Each AMQP port can have its own aliases, such as in this extract:

{code:javascript}
"ports" : [ {
    "id" : "97ec1159-9246-45d8-afc8-e6f821587285",
    "name" : "AMQP",
    "port" : "${qpid.amqp_port}",
    "authenticationProvider" : "passwordFile",
    "secureOnlyMechanisms" : [ ],
    "virtualhostaliases" : [ {
      "id" : "06eea1c6-892c-45bc-b8d4-904bd34e67ba",
      "name" : "defaultAlias",
      "type" : "defaultAlias"
    }, {
      "id" : "88a4b8b2-2b1b-4f5a-a91c-5a249e8331ba", 
      "name" : "hostnameAlias",
      "type" : "hostnameAlias"
    }, { 
      "id" : "48991818-3a76-4f35-ab06-18df2d75ee95",
      "name" : "nameAlias",
      "type" : "nameAlias"
    } ]
  }, {
    "id" : "f399487a-5404-47e4-aa33-e841d82bed5c",
    "name" : "AMQPS",
    "type" : "AMQP",
    "authenticationProvider" : "passwordFile",
    "keyStore" : "ssl", 
    "needClientAuth" : false,
    "port" : "5671",
    "transports" : [ "SSL" ],
    "wantClientAuth" : false,
    "virtualhostaliases" : [ {
      "id" : "382c7212-1106-47fa-9929-1559103a3ea0",
      "name" : "defaultAlias",
      "type" : "defaultAlias",
      "durable" : true
    }, {
      "id" : "027a9c63-641a-4db9-95cb-319462cdceda",
      "name" : "hostnameAlias",
      "type" : "hostnameAlias",
      "durable" : true
    }, {
      "id" : "c9a7da73-6255-49f4-9eef-d6738948a87e",
      "name" : "nameAlias",
      "type" : "nameAlias",
      "durable" : true
    } ]
  }
}
{code}

These ports use the standard set of aliases: a "defaultAlias" which will direct 
connections which connect with an empty vhost string to the virtualhost which 
is marked as the "default", a "nameAlias" which will direct the connection to a 
virtualhost based on an exact match between the requested virtualhost and the 
name of the virtualhost object, and a "hostnameAlias" which will direct a 
connection which uses a valid hostname or IP address for the port/address that 
the port is bound to to (since no other config is given) the default virtual 
host.

The hostnameAlias can be modified by addition of a "virtualHostNode" field so 
that it will direct to the given virtual host node rather than the default,
e.g.

{code:javascript}
{
      "name" : "myAlias1",
      "type" : "hostnameAlias",
      "virtualHostNode" : "myVhostNode",
      "durable" : true
} 
{code}

There also exists the pattern matching alias so that a connection requesting a 
vhost matching a particular pattern will be directed as required:

{code:javascript}
{
      "name" : "myAlias2",
      "type" : "patternMatchingAlias",
      "pattern" : "a|b|c.*",
      "virtualHostNode" : "myVhostNode2",
      "durable" : true
} 
{code}

which would direct any requests for virtual hosts "a", "b" or beginning with c 
to the virtual host noe myVhostNode2

Additionally all aliases can be given a priority, the lower priority aliases 
are matched first, e.g.

{code:javascript}
{
      "name" : "myAlias3",
      "type" : "patternMatchingAlias",
      "pattern" : "c.*",
      "priority" : 2,
      "virtualHostNode" : "myVhostNode2",
      "durable" : true
}, {
      "name" : "myAlias4",
      "type" : "patternMatchingAlias",
      "pattern" : ".*t",
      "priority" : 1,
      "virtualHostNode" : "myVhostNode3",
      "durable" : true
}
{code}

Then a request for the virtual host "cat" would be directed to myVhostNode3


Hope this helps.
Rob
 







was (Author: rgodfrey):
Hi [~danlangford],

as you noticed, we haven't currently added a UI for this in the web management 
console, though the mechanisms for adding/removing/modifying the aliases are 
available through the HTTP management API, or alternatively you can just hand 
edit the json config file.  

Each AMQP port can have its own aliases, such as in this extract:

{code:javascript}
"ports" : [ {
    "id" : "97ec1159-9246-45d8-afc8-e6f821587285",
    "name" : "AMQP",
    "port" : "${qpid.amqp_port}",
    "authenticationProvider" : "passwordFile",
    "secureOnlyMechanisms" : [ ],
    "virtualhostaliases" : [ {
      "id" : "06eea1c6-892c-45bc-b8d4-904bd34e67ba",
      "name" : "defaultAlias",
      "type" : "defaultAlias"
    }, {
      "id" : "88a4b8b2-2b1b-4f5a-a91c-5a249e8331ba", 
      "name" : "hostnameAlias",
      "type" : "hostnameAlias"
    }, { 
      "id" : "48991818-3a76-4f35-ab06-18df2d75ee95",
      "name" : "nameAlias",
      "type" : "nameAlias"
    } ]
  }, {
    "id" : "f399487a-5404-47e4-aa33-e841d82bed5c",
    "name" : "AMQPS",
    "type" : "AMQP",
    "authenticationProvider" : "passwordFile",
    "keyStore" : "ssl", 
    "needClientAuth" : false,
    "port" : "5671",
    "transports" : [ "SSL" ],
    "wantClientAuth" : false,
    "virtualhostaliases" : [ {
      "id" : "382c7212-1106-47fa-9929-1559103a3ea0",
      "name" : "defaultAlias",
      "type" : "defaultAlias",
      "durable" : true
    }, {
      "id" : "027a9c63-641a-4db9-95cb-319462cdceda",
      "name" : "hostnameAlias",
      "type" : "hostnameAlias",
      "durable" : true
    }, {
      "id" : "c9a7da73-6255-49f4-9eef-d6738948a87e",
      "name" : "nameAlias",
      "type" : "nameAlias",
      "durable" : true
    } ]
  }
}
{code}

These ports use the standard set of aliases: a "defaultAlias" which will direct 
connections which connect with an empty vhost string to the virtualhost which 
is marked as the "default", a "nameAlias" which will direct the connection to a 
virtualhost based on an exact match between the requested virtualhost and the 
name of the virtualhost object, and a "hostnameAlias" which will direct a 
connection which uses a valid hostname or IP address for the port/address that 
the port is bound to to (since no other config is given) the default virtual 
host.

The hostnameAlias can be modified by addition of a "virtualHostNode" field so 
that it will direct to the given virtual host node rather than the default,
e.g.

{code:javascript}
{
      "name" : "myAlias1",
      "type" : "hostnameAlias",
      "virtualHostNode" : "myVhostNode",
      "durable" : true
} 
{code}

There also exists the pattern matching alias so that a connection requesting a 
vhost matching a particular pattern will be directed as required:

{code:javascript}
{
      "name" : "myAlias2",
      "type" : "patternMatchingAlias",
      "pattern" : "a|b|c.*",
      "virtualHostNode" : "myVhostNode2",
      "durable" : true
} 
{code}

which would direct any requests for virtual hosts "a", "b" or beginning with c 
to the virtual host noe myVhostNode2

Additionally all aliases can be given a priority, the lower priority aliases 
are matched first, e.g.

{code:javascript}
{
      "name" : "myAlias3",
      "type" : "patternMatchingAlias",
      "pattern" : "c.*",
      "priority" : 2,
      "virtualHostNode" : "myVhostNode2",
      "durable" : true
}, {
      "name" : "myAlias4",
      "type" : "patternMatchingAlias",
      "pattern" : "*.t",
      "priority" : 1,
      "virtualHostNode" : "myVhostNode3",
      "durable" : true
}
{code}

Then a request for the virtual host "cat" would be directed to myVhostNode3


Hope this helps.
Rob
 






> [Java Broker] Add support for virtual host aliasing
> ---------------------------------------------------
>
>                 Key: QPID-6161
>                 URL: https://issues.apache.org/jira/browse/QPID-6161
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Java Broker
>            Reporter: Rob Godfrey
>            Assignee: Rob Godfrey
>             Fix For: 0.31
>
>
> Add the ability to configure how a connection request for a given 
> "host"/"virtualhost" is translated to assigning to a virtual host inside the 
> broker.  Allow for multiple names to match the same virtualhost, for 
> different ports to have different mappings, etc.



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