Connecting to ActiveMQ Artemis Docker Container with Core API

I am attempting to use the ActiveMQ Artemis Core API to connect to ActiveMQ Artemis running in a docker container.

I am using the following code to attempt the connection.

  • Cannot receieve response from activemq when using docker
  • ActiveMQ topic wildcards not working
  • Improving performance of inserting into Mongo from ActiveMQ
  • Connecting to remote activemq instance running on docker container
  • ActiveMQ within Wildfly on a Docker container gives: Invalid “host” value “0.0.0.0” detected
  • Wildfly: AMQ214016: Failed to create netty connect ion java.nio.channels.UnresolvedAddressException from client on natted network
  • Map<String,Object> connectionParams = new HashMap<String, Object>();
    connectionParams.put(TransportConstants.PORT_PROP_NAME, "61616");
    connectionParams.put(TransportConstants.HOST_PROP_NAME, "localhost");
    
    
    TransportConfiguration tc = new TransportConfiguration(NettyConnectorFactory.class.getName(),connectionParams);
    
    ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(tc);
    
    ClientSessionFactory queueFactory = locator.createSessionFactory();
    

    Upon running I get the following error when I attempt to create the session factory.

    ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]

    It seems to be that I am missing a critical configuration step when trying to connect to the ActiveMQ Artemis broker. Is there an XML file I need to place somewhere in my Java client application or can I set the proper settings in code?

    The Docker image for AtiveMQ Artemis I am using:

    https://github.com/vromero/activemq-artemis-docker

  • Rails app under Docker - how to handle container dependencies?
  • How to send http request from Docker to localhost or Virtual Machine
  • Azk with phpmyadmin
  • Docker build “Could not resolve 'archive.ubuntu.com'” apt-get fails to install anything
  • How to forward source IPs to Docker containers without letting Docker mess with iptables
  • How can I create a docker image from the current system?
  • One Solution collect form web for “Connecting to ActiveMQ Artemis Docker Container with Core API”

    Maybe you forgot to expose the port publicly via -p 61616:61616

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.