Red Hat AMQ 6
As of February 2025, Red Hat is no longer supporting Red Hat AMQ 6. If you are using AMQ 6, please upgrade: Migrating to AMQ 7.1.4. Port Configuration
This section describes how to configure, map, and assign ports when you want to connect to the JBoss A-MQ application.
1.4.1. Choosing SSL or Non-SSL Ports Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
When you deploy your JBoss A-MQ application you can choose to use an SSL connection or non-SSL connection.
- SSL connection
- This connection uses static predefined ports to connect to the JBoss A-MQ application. SSL connections are slower than non-SSL connections due to processing overhead at run-time, but you can determine the port number to use at run-time when you first install the application.
- Non-SSL connection
- This connection uses a dynamic port number that OpenShift Enterprise allocates based on the available ports when you install the JBoss A-MQ application. After you install the application, you must determine which port numbers the clients need to use to connect to the application.
Configuring an SSL connection Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
- In the ActiveMQ JMS client, specify the SSL port number in the
ActiveMQConnectionFactory
property. By default, the following port numbers are available for SSL connections:- Openwire
- 2303
- STOMP
- 2304
- AMQP 1.0
- 2305
- MQTT 3.1
- 2306
- Copy the contents of the self-signed public server certificate to a file named
server.crt
and store the file in your local machine. You can access the certificate with the URL that appears when you first install the JBoss A-MQ application, or from the default profile directory in the Wiki tab of the Fuse Management Console. - Run the following command to create a Java keystore that imports the certificate:
keytool -importcert -keystore my.jks -storepass password \ -file server.crt -noprompt
$ keytool -importcert -keystore my.jks -storepass password \ -file server.crt -noprompt
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the JVM to use the keystore when the client connects to the application:
java -Djavax.net.ssl.trustStore=my.jks ...
$ java -Djavax.net.ssl.trustStore=my.jks ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configuring a non-SSL connection Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
- After you install the JBoss A-MQ cartridge, run one of the following commands:
$echo ${OPENSHIFT_AMQ_OPENWIRE_PROXY_PORT} $echo ${OPENSHIFT_AMQ_MQTT_PROXY_PORT} $echo ${OPENSHIFT_AMQ_AMQP_PROXY_PORT} $echo ${OPENSHIFT_AMQ_STOMP_PROXY_PORT}
$echo ${OPENSHIFT_AMQ_OPENWIRE_PROXY_PORT} $echo ${OPENSHIFT_AMQ_MQTT_PROXY_PORT} $echo ${OPENSHIFT_AMQ_AMQP_PROXY_PORT} $echo ${OPENSHIFT_AMQ_STOMP_PROXY_PORT}
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Specify the port number that the broker returns in the connection URL. For example:
tcp://amq-demo.openshift.example.com:63373
tcp://amq-demo.openshift.example.com:63373
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.4.2. Port Binding Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Some Camel components and CXF endpoints must bind to specific ports to enable client connections. When you configure the JBoss A-MQ cartridge you must bind components such as camel-netty to these ports.
You can use the following system properties variables to bind components to private ports:
app1.port
app2.port
app3.port
Note
If you deploy an ActiveMQ container, the
app1.port
system property is reserved for the container.
You specify the port system property in the connection properties with the following format:
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
${bind.address}:${system_property}
${bind.address}:${system_property}
To bind a component to a public port, you use the following connection address format:
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
${publichostname}:${app1.public.port}
${publichostname}:${app1.public.port}
1.4.3. Public Port Mapping Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
The JBoss A-MQ cartridge includes the PublicPortMapper tool that translates private ports in CXF endpoint addresses to public ports. This tool ensures that users can connect to the JBoss A-MQ application from outside the OpenShift Enterprise domain without exposing the private ports that CXF requires to run.
The following CXF components use the PublicPortMapper tool:
- io.fabric8.cxf.registry.FabricCxfRegistrationHandler
- This handler uses the PublicPortMapper tool to translate CXF endpoint addresses. The tool maps the port for each endpoint based on the
address
property of thejaxws:server
element:<jaxws:server id="service1" serviceClass="io.fabric8.demo.cxf.Hello" address="http://$[bind.address]:$[app1.port]/server/server1">
<jaxws:server id="service1" serviceClass="io.fabric8.demo.cxf.Hello" address="http://$[bind.address]:$[app1.port]/server/server1">
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example shows the source address of a CXF endpoint:http://127.2.123.129:3001/server/server1
http://127.2.123.129:3001/server/server1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example shows the translated external URL:http://app-domain.openshift.com:47106/server/server1
http://app-domain.openshift.com:47106/server/server1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The tool writes the translated address to one of the following ZooKeeper paths:/fabric/registry/clusters/apis/rest/{name}/{version}/{container}
/fabric/registry/clusters/apis/ws/{name}/{version}/{container}
- io.fabric8.cxf.FabricLoadBalancerFeature
- This feature uses the PublicPortMapper tool to translate the addresses of all endpoints in the cluster. The tool maps the ports based on the list of addresses in the
group
array property of the feature.Each time thejaxws:server
component starts, the io.fabric8.cxf.FabricServerListener service retrieves the addresses from all active endpoints and stores the addresses in the group property. The feature then invokes the PublicPortMapper tool to translate the addresses to external connection URLs.The tool writes the addresses to the following ZooKeeper path:/fabric/cxf/endpoints/<path-configured-for-FabricLoadBalancerFeature>
/fabric/cxf/endpoints/<path-configured-for-FabricLoadBalancerFeature>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - io.fabric8.camel.FabricPublisherEndpoint
- This endpoint uses the PublicPortMapper tool to translate the address of the listener based on the
from uri
property of the io.fabric8.camel.FabricComponent route.The following example shows the source address of a Jetty listener:The tool writes the translated address to the following ZooKeeper path:<from uri="fabric-camel:cluster:jetty:http://0.0.0.0:[[port]]/fabric"/>
<from uri="fabric-camel:cluster:jetty:http://0.0.0.0:[[port]]/fabric"/>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The following example shows the translated address:/fabric/clusters/fabric/registry/camel/endpoints/cluster/<cluster_instance_number>
/fabric/clusters/fabric/registry/camel/endpoints/cluster/<cluster_instance_number>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow http://fuse0-test.openshift.example.com:40257/fabric
http://fuse0-test.openshift.example.com:40257/fabric
Copy to Clipboard Copied! Toggle word wrap Toggle overflow