Out of the box, Apache ActiveMQ, supports a few Discovery protocols, e.g. multicast, static and master-slave
This library adds support for performing Discovery against a Consul agent, by specifying API access point and service name.
Currently, the library is in a proof-of-concept state and has only been tested against Jboss A-MQ but should work fine with vanilla ActiveMQ as well.
mvn clean install
cp target/active-mq-consul-discovery-[VERSION]-jar-with-dependencies.jar [JBOSS A-MQ HOME]/deploy/
Configure a network connector with consul
as URI in activemq.xml
<networkConnectors>
<networkConnector uri="consul:(http://consul.example.com?service=active-mq&address=amq.example.com&port=61616)"/>
</networkConnectors>
This will perform discovery against http://consul.example.com/v1/health/service/active-mq, i.e. the actual API endpoint is automatically appended and should NOT be included in the URI.
The following parameters are required:
- service
- the name of the service to register with Consul
- address
- the address to the service, i.e the host at which A-MQ listens
- port
- the port on which A-MQ listens
The following parameters are supported but not required:
- serviceId
- the ID for this instance of the service. Will be randomly generated if left out.
- maxQuarantineTime
- The maximum time to quarantine a failing peer service that is still available in Consul. Defaults at 120 000 ms
- interval
- The interval with which to poll Consul for service instances. Defaults at 30 000 ms
Tested in Jboss EAP 6.4 Make sure the active-mq consul client JAR is included in the resource adapter module, and enter a URI similar to this:
discovery:(consul:(http://consul:8500?service=active-mq&clientOnly=true))
Planned items are:
- Maven releases
Feel free to make feature requests or preferably pull requests!
Licensed under the Apache License, Version 2.0